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

Series.quantile returns None with datetime type data #12448

Open
2 tasks done
jeanai28 opened this issue Nov 14, 2023 · 2 comments
Open
2 tasks done

Series.quantile returns None with datetime type data #12448

jeanai28 opened this issue Nov 14, 2023 · 2 comments
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars

Comments

@jeanai28
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
import datetime as dt

ts = pl.Series([dt.datetime(2023,10,3,3), dt.datetime(2023,11,1,2)])
print(ts.quantile(0.5))

Log output

None

Issue description

quantile function will return None if the input colume or series is datetime type. It works fine if I converted it into Int64 type.

Expected behavior

return a datetime of the same type of the input column

Installed versions

Replace this line with the output of pl.show_versions(). Leave the backticks in place.

--------Version info---------
Polars: 0.19.13
Index type: UInt32
Platform: Linux-6.2.0-34-generic-x86_64-with-glibc2.35
Python: 3.11.5 (main, Sep 11 2023, 13:54:46) [GCC 11.2.0]

----Optional dependencies----
adbc_driver_sqlite:
cloudpickle:
connectorx:
deltalake:
fsspec:
gevent:
matplotlib: 3.7.2
numpy: 1.26.0
openpyxl:
pandas: 2.1.1
pyarrow: 14.0.1
pydantic:
pyiceberg:
pyxlsb:
sqlalchemy:
xlsx2csv:
xlsxwriter:

@jeanai28 jeanai28 added bug Something isn't working python Related to Python Polars labels Nov 14, 2023
@reswqa
Copy link
Collaborator

reswqa commented Nov 15, 2023

I'm actually a little unsure whether operation like sum/mean/quantile makes sense for datetime dtype.

@jeanai28
Copy link
Author

jeanai28 commented Nov 16, 2023

I agree that sum and mean may not be meaningful for datetimes, but I don't see any ambiguity in quantile/min/max operator since the datetime is well ordered. I find that I can use np.quantile(pl.Series([dt.datetime(2023,10,3,3), dt.datetime(2023,11,1,2)]), 0.5) to work around it.

@stinodego stinodego added the needs triage Awaiting prioritization by a maintainer label Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage Awaiting prioritization by a maintainer python Related to Python Polars
Projects
None yet
Development

No branches or pull requests

3 participants