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: DatetimeIndex with non-nano values and freq='D' throws ValueError #50773

Merged
merged 3 commits into from
Jan 17, 2023

Conversation

MarcoGorelli
Copy link
Member

@MarcoGorelli MarcoGorelli commented Jan 16, 2023

@MarcoGorelli MarcoGorelli added the Non-Nano datetime64/timedelta64 with non-nanosecond resolution label Jan 16, 2023
@MarcoGorelli MarcoGorelli marked this pull request as ready for review January 16, 2023 13:00
@@ -357,7 +357,7 @@ def _from_sequence_not_strict(

if inferred_freq is None and freq is not None:
# this condition precludes `freq_infer`
cls._validate_frequency(result, freq, ambiguous=ambiguous)
cls._validate_frequency(result, freq, ambiguous=ambiguous, unit=result.unit)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have a branch where i added unit=index.unit inside _validate_frequency. any reason to that here instead of there?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry which branch?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a local branch

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that works too

Copy link
Member

@jbrockmendel jbrockmendel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jbrockmendel jbrockmendel merged commit f941b76 into pandas-dev:main Jan 17, 2023
@jbrockmendel
Copy link
Member

thanks @MarcoGorelli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Non-Nano datetime64/timedelta64 with non-nanosecond resolution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: DatetimeIndex with non-nano values and freq='D' throws ValueError
2 participants