posit-dev / posit-dev/py-shiny
Data frame fails when columns are integers
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.8k
- Forks
- 135
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 21
Description
We should convert column names to character in the decorator.
from shiny import App, reactive, ui, render
import pandas as pd
df = pd.DataFrame({1: [1, 2, 3], 2: [4, 5, 6]})
app_ui = ui.page_fluid(ui.output_data_frame("char_df"), ui.output_data_frame("int_df"))
def server(input, output, session):
@output
@render.data_frame()
def char_df():
df2 = df.copy()
df2.columns = df2.columns.astype(str)
return df2
@output
@render.data_frame()
def int_df():
return df
app = App(app_ui, server, debug=False)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the render.data_frame decorator and reproduce the example using the integer-named pandas DataFrame. Compare it with the version whose columns are converted to strings; done means both data frames render successfully with equivalent column labels.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- pandas, python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100