Skip to content

Fix explode to preserve datetime unit in Series and DataFrame; update… #61612

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Narendersingh007
Copy link

This PR fixes an issue where the explode method in both Series and DataFrame does not preserve the datetime unit information (such as milliseconds or microseconds) of DatetimeIndex or datetime-like data. Previously, exploding a datetime-like Series or DataFrame column would convert timestamps to nanosecond resolution, losing the original unit precision.

The fix ensures that after exploding, the resulting Series or DataFrame retains the original datetime unit dtype, maintaining consistency and avoiding unwanted dtype changes.

Additionally, relevant tests have been updated and extended to verify that the datetime unit is preserved through explode operations in both single- and multi-column cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: explode() converts timestamps at millisecond resolution in DatetimeIndex to nanosecond resolution
1 participant