Open DeflateAwning opened 4 months ago
Can reproduce.
It seems to happen with lists also.
>>> pl.DataFrame({"x": [1]}).with_columns(y = [pl.lit(3)])
shape: (1, 2)
┌─────┬─────────────────┐
│ x ┆ y │
│ --- ┆ --- │
│ i64 ┆ list[extension] │
╞═════╪═════════════════╡
│ 1 ┆ [dyn int: 3] │
└─────┴─────────────────┘
pl.DataFrame({"x": [1, 2]}).with_columns(y = [pl.lit(3)])
# PanicException: called `Result::unwrap()` on an `Err` value: InvalidOperation(ErrString("`list_builder` operation not supported for dtype `object`"))
Checks
Reproducible example
Log output
No response
Issue description
Polars panics if a tuple kwarg is passed to
df.with_columns(...)
For example:
df.with_columns(col_name = accidental_tuple_here)
If you do the same thing with a
df.select(...)
, you get the following output:While I suppose you could technically want that for some insane metaprogramming thing, I think that both should result in an error like
"You probably made a typo. Remove the extra comma you added by accident at the end of the {col_name} kwarg spec."
Expected behavior
I think that both
df.with_columns
anddf.select
should result in an error like"You probably made a typo. Remove the extra comma you added by accident at the end of the {col_name} kwarg spec."
, if this issues is encountered.At the very least, it shouldn't panic.
Installed versions
Tried with both v0.20.25 and v1.0.0.