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

Fill_null() changes Int64 data type to List(Int64) on aggregation #19984

Closed
2 tasks done
lmocsi opened this issue Nov 25, 2024 · 0 comments · Fixed by #19993
Closed
2 tasks done

Fill_null() changes Int64 data type to List(Int64) on aggregation #19984

lmocsi opened this issue Nov 25, 2024 · 0 comments · Fixed by #19993
Assignees
Labels
accepted Ready for implementation bug Something isn't working python Related to Python Polars

Comments

@lmocsi
Copy link

lmocsi commented Nov 25, 2024

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.LazyFrame({'id':[1,1,2,2,3,3],'b':[11,None,33,44,None,66]})
print('ok:    ',df.group_by('id').agg(pl.col('b').sum()).collect_schema())
print('not ok:',df.group_by('id').agg(pl.col('b').sum().fill_null(0)).collect_schema())

Log output

ok:     Schema([('id', Int64), ('b', Int64)])
not ok: Schema([('id', Int64), ('b', List(Int64))])

Issue description

Upon aggregation, if I add .fill_null(0) to an Int64 column, then its datatype changes to List(Int64).

Expected behavior

Data type should not change with a .fill_null() addition.

Installed versions

--------Version info---------
Polars:              1.14.0
Index type:          UInt32
Platform:            Linux-5.10.223-212.873.amzn2.x86_64-x86_64-with-glibc2.26
Python:              3.9.20 | packaged by conda-forge | (main, Sep 30 2024, 17:49:10) 
[GCC 13.3.0]
LTS CPU:             False

----Optional dependencies----
adbc_driver_manager  <not installed>
altair               <not installed>
boto3                1.35.63
cloudpickle          3.1.0
connectorx           <not installed>
deltalake            <not installed>
fastexcel            <not installed>
fsspec               2024.10.0
gevent               <not installed>
google.auth          2.36.0
great_tables         <not installed>
matplotlib           <not installed>
nest_asyncio         1.6.0
numpy                1.26.4
openpyxl             <not installed>
pandas               1.5.3
pyarrow              14.0.2
pydantic             <not installed>
pyiceberg            <not installed>
sqlalchemy           <not installed>
torch                <not installed>
xlsx2csv             <not installed>
xlsxwriter           <not installed>
@lmocsi lmocsi added bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars labels Nov 25, 2024
@nameexhaustion nameexhaustion self-assigned this Nov 26, 2024
@nameexhaustion nameexhaustion removed the needs triage Awaiting prioritization by a maintainer label Nov 26, 2024
@c-peters c-peters added the accepted Ready for implementation label Dec 2, 2024
@github-project-automation github-project-automation bot moved this to Ready in Backlog Dec 2, 2024
@c-peters c-peters moved this from Ready to Done in Backlog Dec 2, 2024
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
3 participants