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 hierarchical multi-indexed DataFrame #1383

Merged
merged 4 commits into from
Jun 4, 2020

Conversation

philippjfr
Copy link
Member

This PR improves the DataFrame widget in a two ways relating to support for DataFrame indexes:

  1. It fixes a bug editing DataFrames with a non-default index name
  2. It adds support for displaying hierarchical multi-indexed dataframes with aggregators

As an example here is a three-level DataFrame aggregated over the indexes:

from bokeh.sampledata.population import data as population_data 

pop_df = population_data[population_data.Year == 2020].set_index(['Location', 'Sex', 'AgeGrp'])[['Value']]

pn.widgets.DataFrame(value=pop_df, hierarchical=True, aggregators={'Sex': 'sum', 'Location': 'sum'}, height=400) 

Screen Shot 2020-06-04 at 3 10 24 PM

@philippjfr philippjfr added the type: enhancement Minor feature or improvement to an existing feature label Jun 4, 2020
@codecov
Copy link

codecov bot commented Jun 4, 2020

Codecov Report

Merging #1383 into master will increase coverage by 0.07%.
The diff coverage is 92.75%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1383      +/-   ##
==========================================
+ Coverage   87.68%   87.75%   +0.07%     
==========================================
  Files         130      130              
  Lines       13928    14002      +74     
==========================================
+ Hits        12213    12288      +75     
+ Misses       1715     1714       -1     
Impacted Files Coverage Δ
panel/widgets/tables.py 85.40% <92.53%> (+5.25%) ⬆️
panel/tests/widgets/test_tables.py 97.19% <100.00%> (+0.64%) ⬆️
panel/widgets/base.py 89.88% <0.00%> (+2.24%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 19f0827...8378386. Read the comment docs.

@philippjfr philippjfr merged commit d3514b3 into master Jun 4, 2020
@philippjfr philippjfr deleted the table_enhancements branch June 4, 2020 13:51
@jbednar
Copy link
Member

jbednar commented Jun 4, 2020

Cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Minor feature or improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants