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

Add note on dicts and arrays conversion to Pandas #4976

Merged
merged 2 commits into from
Jan 23, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add note on dicts and arrays
LiamConnors committed Jan 21, 2025
commit 2aa76bfb1637d534b0758088dea86b7fdafa2cfc
2 changes: 2 additions & 0 deletions doc/python/px-arguments.md
Original file line number Diff line number Diff line change
@@ -244,6 +244,8 @@ fig = px.density_contour(dict(effect_size=5 + np.random.randn(N),
fig.show()
```

To pass a `dict` or an array (such as a NumPy `ndarray`) to the `data_frame` argument, you'll need to have pandas installed, because `plotly.express` internally converts the `dict` or array to a pandas DataFrame.

#### Integer column names

When the `data_frame` argument is a NumPy array, column names are integer corresponding to the columns of the array. In this case, keyword names are used in axis, legend and hovers. This is also the case for a pandas DataFrame with integer column names. Use the `labels` argument to override these names.