-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot create dataframe containing null values #20
Comments
While looking into this one, I noticed that providing arrays into the object: const lf = pl.DataFrame({ a: [1], b: [2], c: [null] });
console.log(lf); returns
Because of this notice of the documentation:
I am a little bit hesistant whether I should further check this? |
It's probably not a high priority ticket as you've demonstrated a workaround. I am coming from pandas where the other syntax does work.
|
I have a created a PR for this issue. |
But I do see a problem after my PR. |
I believe this is a known issue in the polars json parser. which the JS parser is mostly based off of. |
for those who want a temporary solution, you can check if such column in the const data3 = [
{ col1: "b", col2: "d", str: "1 -> 1 -> 2", time: 1691565256703, col3: null },
{ col1: "b", col2: "c", str: "2 -> 2 -> 1", col3: null },
{ col1: "c", col2: "a", str: "3 -> 3 -> 3", col3: null },
];
let df3 = pl.DataFrame(data3 );
if (!df3.columns.includes('col3')) {
df3 = df3.withColumn(pl.lit(null).alias("col3"));
}
┌──────┬──────┬─────────────┬───────────┬──────┐
│ col1 ┆ col2 ┆ str ┆ time ┆ col3 │
│ --- ┆ --- ┆ --- ┆ --- ┆ --- │
│ str ┆ str ┆ str ┆ f64 ┆ null │
╞══════╪══════╪═════════════╪═══════════╪══════╡
│ b ┆ d ┆ 1 -> 1 -> 2 ┆ 1.6916e12 ┆ null │
│ b ┆ c ┆ 2 -> 2 -> 1 ┆ null ┆ null │
│ c ┆ a ┆ 3 -> 3 -> 3 ┆ null ┆ null │
└──────┴──────┴─────────────┴───────────┴──────┘ |
Have you tried latest version of polars?
What version of polars are you using?
0.6.0
What operating system are you using polars on?
Linux 5.4.0-132-generic #148-Ubuntu
What node version are you using
Describe your bug.
Try to create a dataframe with a value that is null results in an unwrap on a None value in rust and a panic.
What are the steps to reproduce the behavior?
Try to create a dataframe with a null value
What is the actual behavior?
What is the expected behavior?
Polars should have created the dataframe with a null value for column c
The text was updated successfully, but these errors were encountered: