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

[BUG] datetime binops need to factor in datetime max resolution #17740

Open
galipremsagar opened this issue Jan 15, 2025 · 0 comments
Open

[BUG] datetime binops need to factor in datetime max resolution #17740

galipremsagar opened this issue Jan 15, 2025 · 0 comments
Assignees
Labels
bug Something isn't working Python Affects Python cuDF API.

Comments

@galipremsagar
Copy link
Contributor

Describe the bug
Max resolution of datetime.datetime is microsecond, so we need to assume the dtype of the datetime scalar is microsecond for our binary ops.

Steps/Code to reproduce bug

In [1]: import cudf

In [2]: import pandas as pd

In [4]: import datetime

In [5]: ser = pd.Series([pd.Timestamp(datetime.datetime(1993, 1, 7, 13, 30, 00))], dtype="M8[s]")

In [6]: dt = datetime.datetime(1993, 6, 22, 13, 30)

In [7]: ser
Out[7]: 
0   1993-01-07 13:30:00
dtype: datetime64[s]

In [8]: dt
Out[8]: datetime.datetime(1993, 6, 22, 13, 30)

In [9]: ser - dt
Out[9]: 
0   -166 days
dtype: timedelta64[us]

In [10]: ser = cudf.from_pandas(ser)
s
In [11]: ser
Out[11]: 
0   1993-01-07 13:30:00
dtype: datetime64[s]

In [12]: ser - dt
Out[12]: 
0   -166 days
dtype: timedelta64[s] # expected `us`
@galipremsagar galipremsagar added bug Something isn't working Python Affects Python cuDF API. labels Jan 15, 2025
@galipremsagar galipremsagar self-assigned this Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Python Affects Python cuDF API.
Projects
Status: Todo
Development

No branches or pull requests

1 participant