We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
pl.lit
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of Polars.
The newly added set operations seem to have problems with using pl.lit(). They only work as expected on other dataframe columns.
pl.lit()
import polars as pl df = pl.DataFrame({"a": [[1, 2, 3], [4, 5]]}) df.with_columns(b=pl.lit([[3, 4, 6]])).select(pl.col("a").list.intersection("b")) # shape: (2, 1) # ┌───────────┐ # │ a │ # │ --- │ # │ list[i64] │ # ╞═══════════╡ # │ [3] │ # │ [4] │ # └───────────┘ df.select(pl.col("a").list.intersection(pl.lit([[3, 4, 6]]))) # PanicException: assertion failed: `(left == right)` # left: `3`, # right: `2`
The behavior should be identical between using a literal expression or an existing dataframe column.
--------Version info--------- Polars: 0.18.6 Index type: UInt32 Platform: Linux-5.4.0-1103-aws-x86_64-with-glibc2.31 Python: 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:40:32) [GCC 12.3.0] ----Optional dependencies---- adbc_driver_sqlite: <not installed> connectorx: <not installed> deltalake: <not installed> fsspec: <not installed> matplotlib: 3.7.1 numpy: 1.21.6 pandas: 1.5.3 pyarrow: 12.0.0 pydantic: 1.10.9 sqlalchemy: 1.4.48 xlsx2csv: <not installed> xlsxwriter: <not installed>
The text was updated successfully, but these errors were encountered:
This is intended, see here
Sorry, something went wrong.
Hmm fair, but then I would expect this to behave similarly to is_in which can also take literal lists as arguments, no?
is_in
df.select(pl.col("a").list.intersection([3, 4, 6])) # PanicException: assertion failed: `(left == right)` # left: `3`, # right: `2`
I'm not following you.
No, the literal should broadcast in this case. As it is an argument to the set function. That's within our broadcasting rules.
This was solved in #10668.
No branches or pull requests
Polars version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of Polars.
Issue description
The newly added set operations seem to have problems with using
pl.lit()
. They only work as expected on other dataframe columns.Reproducible example
Expected behavior
The behavior should be identical between using a literal expression or an existing dataframe column.
Installed versions
The text was updated successfully, but these errors were encountered: