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
I've got some code that essentially does the following:
Reads some data into a pl.LazyFrame
Appends a pl.Series to the pl.LazyFrame using pl.LazyFrame.with_column()
Does a .groupby().agg().collect()
This code worked fine until I updated my dependencies from 0.14.30 to 0.15. The documentation appears to indicate that this behavior should still work, so I believe this is a bug.
A minimal working example and the traceback is below.
Reproducible example
importpolarsaspldf=pl.DataFrame({"col_1": [0] *5+ [1] *5})
ser=pl.Series("col_2", list(range(10)))
# these three lines below work as expected#df.lazy().groupby("col_1").agg(pl.col("*").count()).collect()#df.lazy().with_column(ser).collect()#df.with_column(ser).groupby("col_1").agg(pl.col("*").count())# this works in <0.15 but raises an exception in >=0.15df.lazy().with_column(ser).groupby("col_1").agg(pl.col("*").count()).collect()
Expected behavior
Actual output:
Traceback (most recent call last):
File ".../bug_example.py", line 15, in <module>
df.lazy().with_column(ser).groupby("col_1").agg(pl.col("*").count()).collect()
File ".../.venv/lib/python3.9/site-packages/polars/utils.py", line 337, in wrapper
return fn(*args, **kwargs)
File ".../.venv/lib/python3.9/site-packages/polars/internals/lazyframe/frame.py", line 1154, in collect
return pli.wrap_df(ldf.collect())
exceptions.ShapeError: Could not add column. The Series length 10 differs from the DataFrame height: 1
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
I've got some code that essentially does the following:
This code worked fine until I updated my dependencies from 0.14.30 to 0.15. The documentation appears to indicate that this behavior should still work, so I believe this is a bug.
A minimal working example and the traceback is below.
Reproducible example
Expected behavior
Actual output:
Expected output: nothing
Installed versions
The text was updated successfully, but these errors were encountered: