Skip to content
New issue

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

Over None gives None instead of str #13173

Closed
2 tasks done
MariusMerkleQC opened this issue Dec 21, 2023 · 1 comment · Fixed by #13179
Closed
2 tasks done

Over None gives None instead of str #13173

MariusMerkleQC opened this issue Dec 21, 2023 · 1 comment · Fixed by #13179
Assignees
Labels
accepted Ready for implementation bug Something isn't working python Related to Python Polars

Comments

@MariusMerkleQC
Copy link

Checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of Polars.

Reproducible example

import polars as pl

df = pl.DataFrame(data = {"color": ["yellow", "yellow"], "color2": [None, "light"], "val": ["2", "3"]})

df = df.with_columns(pl.min("val").over(["color", "color2"]).alias("min_val_per_color"))
print(df)

Log output

No response

Issue description

When the column "val" is of type pl.Utf8, it will set the aggregated value to None if any value in the group is `None. You get the additional column "min_val_per_color: [None, 3]".

Expected behavior

I would expect the dataframe to get the additional column "min_val_per_color: [2, 3]". This is also what happens when the datatype of "val" is numeric.

Installed versions

--------Version info---------
Polars:               0.20.1
Index type:           UInt32
Platform:             macOS-14.1.1-arm64-arm-64bit
Python:               3.12.0 | packaged by conda-forge | (main, Oct  3 2023, 08:36:57) [Clang 15.0.7 ]

----Optional dependencies----
adbc_driver_manager:  <not installed>
cloudpickle:          <not installed>
connectorx:           <not installed>
deltalake:            <not installed>
fsspec:               <not installed>
gevent:               <not installed>
matplotlib:           <not installed>
numpy:                1.26.2
openpyxl:             <not installed>
pandas:               <not installed>
pyarrow:              <not installed>
pydantic:             <not installed>
pyiceberg:            <not installed>
pyxlsb:               <not installed>
sqlalchemy:           <not installed>
xlsx2csv:             <not installed>
xlsxwriter:           <not installed>
None
@MariusMerkleQC MariusMerkleQC added bug Something isn't working python Related to Python Polars labels Dec 21, 2023
@cmdlineluser
Copy link
Contributor

This last worked in 0.19.19

Seems to have changed after 34330ec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation bug Something isn't working python Related to Python Polars
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants