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

Ensure date sorting of multi index Pandas dataframes #1363

Merged
merged 3 commits into from
Jul 19, 2024

Conversation

maximlt
Copy link
Member

@maximlt maximlt commented Jun 30, 2024

Fixes #1361

Also:

  • Cleans up some imports in the test suite, since pandas and panel are direct dependencies of hvPlot their import doesn't need to be guarded
  • Update some test code to HoloViews 1.19

Copy link

codecov bot commented Jun 30, 2024

Codecov Report

Attention: Patch coverage is 98.03922% with 1 line in your changes missing coverage. Please review.

Project coverage is 88.54%. Comparing base (6c96c7e) to head (7b978e2).
Report is 6 commits behind head on main.

Files Patch % Lines
hvplot/tests/testutil.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1363      +/-   ##
==========================================
+ Coverage   87.39%   88.54%   +1.15%     
==========================================
  Files          50       50              
  Lines        7490     7362     -128     
==========================================
- Hits         6546     6519      -27     
+ Misses        944      843     -101     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@ahuang11 ahuang11 left a comment

Choose a reason for hiding this comment

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

Looks good to me

import hvplot.pandas
import pandas as pd
import numpy as np


# datetime column with groups and value

df = pd.DataFrame({
    'datetime': pd.date_range('2020-01-01', periods=100, freq='D'),
    'group': ['A', 'B', 'C', 'D'] * 25,
    'value': np.random.randn(100)
})
df = df.sample(frac=1).set_index(["datetime", "group"])

df.hvplot(x='datetime', y='value', by='group', kind='line')
image

@maximlt maximlt merged commit 26eb1e4 into main Jul 19, 2024
9 checks passed
@maximlt maximlt deleted the fix_multiindex_datetime_sorting branch July 19, 2024 09:20
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.

No automatic sorting of multilevel datetime indexes
3 participants