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

Add support for non-numeric types in Series.diff and DataFrame.diff #10519

Closed
wants to merge 3 commits into from

Conversation

Matt711
Copy link
Contributor

@Matt711 Matt711 commented Mar 27, 2022

This PR supports non-numeric data types (timestamp and ranges) in Series.diff and DataFrame.diff. In DataFrame.diff, datetime ranges are already supported because DataFrame.shift works. But Series.diff doesn't use the Series.shift implementation, so there wasn't support for datetime ranges.

import datetime
dti = pd.to_datetime(
    ["1/1/2018", np.datetime64("2018-01-01"), datetime.datetime(2018, 1, 1), datetime.datetime(2020, 1, 1)]
)
df = DataFrame({"dates": dti})
df.diff(periods=periods, axis=axis)

closes #10212.

@GPUtester
Copy link
Collaborator

Can one of the admins verify this patch?

@github-actions github-actions bot added the Python Affects Python cuDF API. label Mar 27, 2022
@Matt711
Copy link
Contributor Author

Matt711 commented Mar 27, 2022

@bdice
For now, I replaced the way Series.diff is currently implemented (cudautils.gpu_diff.for_all) with Series.shift but that's not right. How should non-numeric types be supported in Series.diff?

@quasiben
Copy link
Member

add to allowlist

@bdice bdice added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Apr 8, 2022
@Matt711 Matt711 closed this Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement / enhancement to an existing function non-breaking Non-breaking change Python Affects Python cuDF API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEA] Series.diff and DataFrame.diff should support non-numeric types (timestamps, durations)
4 participants