Skip to content

chore: Address pandas deprecation warning in test #4890

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

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

MarcoGorelli
Copy link
Contributor

@MarcoGorelli MarcoGorelli commented Nov 19, 2024

pandas is becoming more case-sensitive about these aliases, to avoid issues like this:

In [3]: pd.date_range('2000', periods=3, freq='NS')  # nanosecond
  pd.date_range('2000', periods=3, freq='NS')
Out[3]:
DatetimeIndex([          '2000-01-01 00:00:00',
               '2000-01-01 00:00:00.000000001',
               '2000-01-01 00:00:00.000000002'],
              dtype='datetime64[ns]', freq='ns')

In [4]: pd.date_range('2000', periods=3, freq='US')  # microsecond
  pd.date_range('2000', periods=3, freq='US')
Out[4]:
DatetimeIndex([       '2000-01-01 00:00:00', '2000-01-01 00:00:00.000001',
               '2000-01-01 00:00:00.000002'],
              dtype='datetime64[ns]', freq='us')

In [5]: pd.date_range('2000', periods=3, freq='MS')  # wait, it's not millisecond?
Out[5]: DatetimeIndex(['2000-01-01', '2000-02-01', '2000-03-01'], dtype='datetime64[ns]', freq='MS')

'h' works across versions without warnings

@gvwilson gvwilson added P2 considered for next cycle community community contribution fix fixes something broken labels Nov 19, 2024
Copy link
Contributor

@emilykl emilykl left a comment

Choose a reason for hiding this comment

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

H has been deprecated since pandas version 2.2.0.

Here is the documentation page with the deprecation notice: https://pandas.pydata.org/docs/user_guide/timeseries.html#timeseries-offset-aliases

Thank you @MarcoGorelli for this change!

@emilykl emilykl merged commit 65acf3d into plotly:master Nov 20, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community community contribution fix fixes something broken P2 considered for next cycle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants