From b8128e4cc842770883cd2e555eecabd40c18a3dc Mon Sep 17 00:00:00 2001 From: Liam Connors Date: Thu, 10 Aug 2023 14:57:41 -0400 Subject: [PATCH] Update px-arguments.md --- doc/python/px-arguments.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/doc/python/px-arguments.md b/doc/python/px-arguments.md index 075e8f928e..d9ae305d18 100644 --- a/doc/python/px-arguments.md +++ b/doc/python/px-arguments.md @@ -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) @@ -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).