Skip to content

Commit

Permalink
Update px-arguments.md
Browse files Browse the repository at this point in the history
  • Loading branch information
LiamConnors committed Aug 10, 2023
1 parent 8145d6c commit b8128e4
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions doc/python/px-arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@ fig.show()

### Input Data as Non-Pandas `DataFrame`s

*New in 5.15 and 5.16*
*New in 5.15*

In the examples above, we've used Pandas DataFrames. You can also provide another type of DataFrame to the `data_frame` argument if that DataFrame has a `to_pandas` method (new in 5.15) or supports the [Python dataframe interchange protocol](https://data-apis.org/dataframe-protocol/latest/index.html) (new in 5.16), for example, a [Polars](https://www.pola.rs/) DataFrame. Plotly Express uses Pandas internally to process the data.
In the examples above, we've used Pandas DataFrames. You can also provide another type of DataFrame to the `data_frame` argument if that DataFrame has a `to_pandas` method, for example, a [Polars](https://www.pola.rs/) DataFrame.

If you are using a type of DataFrame that doesn't have a `to_pandas` method, but supports the Python dataframe interchange protocol, you'll need to have Pandas version 2.0.3 or later installed.
Plotly Express uses Pandas internally to process the data. When you provide a Non-Pandas DataFrame to the `data_frame` argument of a Plotly Express function, the entire DataFrame is converted to a Pandas DataFrame.

In this example, we use a Polars DataFrame. If you are using Polars, you'll need to install `pyarrow`, which is used by its [`to_pandas` method](
https://pola-rs.github.io/polars/py-polars/html/reference/dataframe/api/polars.DataFrame.to_pandas.html)
Expand All @@ -196,6 +196,13 @@ fig = px.bar(wide_df, x="nation", y=["gold", "silver", "bronze"], title="Wide-Fo
fig.show()
```

*New in 5.16*

As of version 5.16, you can also provide another type of DataFrame to the `data_frame` argument if that DataFrame supports the [Python dataframe interchange protocol](https://data-apis.org/dataframe-protocol/latest/index.html), or has a `toPandas` or `to_pandas_df` method.

If you are using a type of DataFrame that doesn't have a `to_pandas`, `toPandas`, or `to_pandas_df` method, but supports the Python dataframe interchange protocol, you'll need to have Pandas version 2.0.3 or later installed.


### Input Data as array-like columns: NumPy arrays, lists...

`px` arguments can also be array-like objects such as lists, NumPy arrays, in both long-form or wide-form (for certain functions).
Expand Down

0 comments on commit b8128e4

Please sign in to comment.