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

Support for Empty Column in DataGrid #1844

Open
jubilee2 opened this issue Feb 6, 2025 · 1 comment
Open

Support for Empty Column in DataGrid #1844

jubilee2 opened this issue Feb 6, 2025 · 1 comment

Comments

@jubilee2
Copy link

jubilee2 commented Feb 6, 2025

Description:

I am trying to use the DataGrid component in the Shiny Express library to display a DataFrame that includes an empty column. However, it seems that the DataGrid does not support empty column names. Below is an example code demonstrating the issue:

import pandas as pd
from shiny.express import render, ui

n = 6
df = pd.DataFrame(
    {
        "": range(n),
        "b": range(n, n * 2),
        "c": range(n * 2, n * 3),
        "d": range(n * 3, n * 4),
        "e": range(n * 4, n * 5),
    }
)

ui.h2("Data Frame with Styles applied to 4 cells")

@render.data_frame
def my_df():
    return render.DataGrid(df)

Current Behavior: The DataGrid fails to render the DataFrame when an empty column name is present.

Expected Behavior: The DataGrid should support DataFrames with empty column names and render them appropriately.

@cpsievert
Copy link
Collaborator

I can confirm this is a bug that should get fixed, but FWIW, a workaround is to replace "" with " ".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants