You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
With the new release our code failed when trying to check if a list contains values from another list. This error only occurs when the data frame contains a single row and the list to compare with has more elements than the list element in the data frame.
Reproducible example
importpolarsaspldf=pl.DataFrame(
{
"row_number": [0, 1],
"str_list": [["a", "b"], ["c", "d"]],
}
)
cmp_list= ["a", "b", "c"] # only a or a, b will not error# this works (filtering to a single row after list evaluation)
(df
.with_columns(
pl.col("str_list").list.eval(
pl.element().is_in(cmp_list)
).alias("comparison")
).filter(pl.col("row_number")==0)
)
# this errors, but should yield the same result as above (filtering to a single row before list evaluation)# InvalidOperationError: output length of `map` (3) must be equal to the input length (2); consider using `apply` instead
(df
.filter(pl.col("row_number")==0)
.with_columns(
pl.col("str_list").list.eval(
pl.element().is_in(cmp_list)
).alias("comparison")
)
)
Expected behavior
The code should work on a data frame with a single row the same way as on a data frame with multiple rows. This used to work in 0.17.5 using the arr namespace.
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
With the new release our code failed when trying to check if a list contains values from another list. This error only occurs when the data frame contains a single row and the list to compare with has more elements than the list element in the data frame.
Reproducible example
Expected behavior
The code should work on a data frame with a single row the same way as on a data frame with multiple rows. This used to work in
0.17.5
using thearr
namespace.Installed versions
The text was updated successfully, but these errors were encountered: