Issues with pandas dataframe with numbers in the column name

Is this a bug or a requirement?

If my dataframe has a number in the column name. plotly/dash will not draw px.line or dash_table

column name has a number example: ‘test1’. if I rename it to ‘test_one’, it works.

HI @jocagovi welcome to the forums.

Could you post your code which shows this behavior? I can’t replicate this.

import plotly.express as px
import pandas as pd
import numpy as np

rows = 4
cols = 4

df = pd.DataFrame(
    np.random.randint(2, 20, size=(rows, cols)), 
    columns=[f'col_{i}' for i in range(cols)]
)

fig = px.line(df, y=df.columns)
fig.show()
1 Like

Hi @jocagovi !
Welcome! :confetti_ball:
Indeed that shouldn’t be an issue to have number in the column names…