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

Implement support for multi-index columns in Tabulator #7108

Merged
merged 2 commits into from
Aug 9, 2024

Conversation

philippjfr
Copy link
Member

Fixes #6794

Adds support for rendering arbitrarily deep column multi-indexes by using the column grouping feature of tabulator:

import pandas as pd
import numpy as np
import panel as pn
pn.extension('tabulator')

# Define the three levels of column index
level_1 = ['A', 'A', 'A', 'B', 'B', 'B']
level_2 = ['one', 'one', 'two', 'two', 'three', 'three']
level_3 = ['X', 'Y', 'X', 'Y', 'X', 'Y']

# Combine these into a MultiIndex
multi_index = pd.MultiIndex.from_arrays([level_1, level_2, level_3], names=['Level 1', 'Level 2', 'Level 3'])

# Create a DataFrame with this MultiIndex as columns
df = pd.DataFrame(np.random.randn(4, 6), columns=multi_index)

pn.Column(df, pn.widgets.Tabulator(df))
Screenshot 2024-08-09 at 10 56 47

Copy link

codecov bot commented Aug 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.23%. Comparing base (07f9be3) to head (be65266).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7108   +/-   ##
=======================================
  Coverage   82.22%   82.23%           
=======================================
  Files         327      327           
  Lines       48725    48750   +25     
=======================================
+ Hits        40066    40089   +23     
- Misses       8659     8661    +2     

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

@philippjfr philippjfr merged commit 41f59e6 into main Aug 9, 2024
15 of 16 checks passed
@philippjfr philippjfr deleted the tabulator_multi_index_cols branch August 9, 2024 09:21
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.

Multi-index columns all blank in Tabulator
1 participant