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

Multi-index columns all blank in Tabulator #6794

Open
ahuang11 opened this issue Apr 25, 2024 · 0 comments
Open

Multi-index columns all blank in Tabulator #6794

ahuang11 opened this issue Apr 25, 2024 · 0 comments
Labels
component: tabulator Related to the Tabulator widget type: bug Something isn't correct or isn't working

Comments

@ahuang11
Copy link
Contributor

ahuang11 commented Apr 25, 2024

import pandas as pd

df = pd.DataFrame({
    'time': pd.to_datetime(['2020-01-01 00:00:00'] * 50 + ['2020-01-01 00:30:00'] * 50),
    'value': range(100),
    'group': ['A', 'B'] * 50
})

# Aggregate values for duplicate time entries by taking the mean
df_agg = df.groupby(['time', 'group']).first().reset_index()
pivot_df = df_agg.pivot(index="time", columns="group", values=["value"])
import panel as pn
pn.extension()
display(pivot_df)
pn.widgets.Tabulator(pivot_df)
image

The work around is to set pivot_df.columns = pivot_df.columns.as_flat_index()

@ahuang11 ahuang11 added the TRIAGE Default label for untriaged issues label Apr 25, 2024
@maximlt maximlt added component: tabulator Related to the Tabulator widget type: bug Something isn't correct or isn't working and removed TRIAGE Default label for untriaged issues labels Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tabulator Related to the Tabulator widget type: bug Something isn't correct or isn't working
Projects
None yet
Development

No branches or pull requests

2 participants