This repository was archived by the owner on Jun 3, 2024. It is now read-only.
This repository was archived by the owner on Jun 3, 2024. It is now read-only.
Support using DataFrame index for colors, labels, x, y, etc. #126
Closed
Description
I often use the DataFrame index for something meaningful, such as a timestamp corresponding to when the data was taken, or a sequence number. In those cases, it'd be great to be able to use that in plotly express to determine the X value, data color, text label, etc.
Currently the workaround is to copy the index to a separate column, e.g.
# Contrived example, but this usually comes from some other system
df = pd.DataFrame({'y': [1,2,3]}, index=[4,5,6])
df['x'] = df.index
px.scatter(df, x=px.INDEX, y='y')
Instead of having to change the DataFrame, it would be nice if I could just go ahead and do something like
df = pd.DataFrame({'y': [1,2,3]}, index=[4,5,6])
px.scatter(df, x=px.INDEX, y='y')
or even, in the special case of using it as an X value, it could be the default:
px.scatter(df, y='y')
Metadata
Metadata
Assignees
Labels
No labels