Closed hanjinliu closed 1 month ago
This is correct. The DataFrame has length 0, so you cannot add a column of length 1.
You can only add literal/scalars of a different length, and they will be broadcasted to the DataFrame. (Currently there is a bug for empty frames we soon fix)
More odd behavior observed, see #18736.
Checks
Reproducible example
Output:
Log output
No response
Issue description
Probably related to #18686, as it raises the same error. The same code worked with
polars=1.6.0
but not withpolars=1.7.0
Expected behavior
df.with_columns(pl.Series("new", [1]))
should return a DataFrame with a single row/column.Installed versions