Skip to content

Commit 593a1ed

Browse files
committed
Update px-arguments.md
1 parent a84f754 commit 593a1ed

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

doc/python/px-arguments.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ jupyter:
3333
thumbnail: thumbnail/plotly-express.png
3434
---
3535

36-
Plotly Express (`px`) is the high-level interface to Plotly and provides functions for generating charts. `px` functions support data provided in a number of different formats (long, wide, and mixed) and as different types of objects, including pandas and Polars DataFrames.
36+
Plotly Express (`px`) is the high-level interface to Plotly and provides functions for generating charts. `px` functions support data provided in a number of different formats (long, wide, and mixed) and as different types of objects, including pandas and Polars dataframes.
3737

3838
## Data for the Examples
3939

40-
The examples on this page use datasets available in the `data` package in `px`. `px.data` contains functions that when called return a dataset as a DataFrame. Some of the datasets included in `px.data` are:
40+
The examples on this page use datasets available in the `data` package in `px`. `px.data` contains functions that when called return a dataset as a dataframe. Some of the datasets included in `px.data` are:
4141

4242
- `carshare` - Each row represents the availability of car-sharing services near the centroid of a zone in Montreal over a month-long period.
4343
- `election` - Each row represents voting results for an electoral district in the 2013 Montreal mayoral election.
@@ -52,7 +52,7 @@ df = px.data.iris()
5252
df.head()
5353
```
5454

55-
By default `px.data` functions return Pandas DataFrames, but you can specify an alternative DataFrame type using `return_type`. `pandas`, `polars`, and `pyarrow` are supported return types.
55+
By default `px.data` functions return a pandas `DataFrame` object, but you can specify an alternative dataframe type using `return_type`. `pandas`, `polars`, and `pyarrow` are supported return types.
5656

5757
```python
5858
df = px.data.iris(return_type='polars')
@@ -115,13 +115,13 @@ fig.show()
115115
Many more examples of wide-form and messy data input can be found in our [detailed wide-form support documentation](/python/wide-form/).
116116

117117

118-
## DataFrame Input
118+
## Dataframe Input
119119

120-
The first argument of every `px` function is `data_frame`. If you provide a DataFrame as a `px` function's first argument, you can then specify column names as strings from the DataFrame as other arguments.
120+
The first argument of every `px` function is `data_frame`. If you provide a dataframe as a `px` function's first argument, you can then specify column names as strings from the dataframe as other arguments.
121121

122-
### Supported DataFrames
122+
### Supported Dataframes
123123

124-
`px` functions natively support the following types of DataFrames:
124+
`px` functions natively support the following types of dataframes:
125125

126126
- pandas
127127
- Polars
@@ -131,13 +131,13 @@ The first argument of every `px` function is `data_frame`. If you provide a Data
131131
> To use Polars, PyArrow, or Modin with Plotly Express, you'll need to have NumPy installed. You can install it with: `pip install numpy`.
132132
To use [trendlines](/python/linear-fits/), you'll also need to have pandas installed.
133133

134-
`px` uses [Narwhals](https://narwhals-dev.github.io/narwhals/) to natively support these DataFrames. Other types of DataFrames that are currently supported by Narwhals may also work with `px`, for example cuDF.
134+
`px` uses [Narwhals](https://narwhals-dev.github.io/narwhals/) to natively support these dataframes. Other types of dataframes that are currently supported by Narwhals may also work with `px`, for example cuDF.
135135

136-
You can also pass DataFrames that are not natively supported, but support the dataframe interchange protocol, or have a `to_pandas()` method.
136+
You can also pass dataframes that are not natively supported, but support the [dataframe interchange protocol](https://data-apis.org/dataframe-protocol/latest/), or have a `to_pandas()` method.
137137

138138
### Example: Using a Pandas DataFrame with `px.bar`
139139

140-
Here, we create a pandas DataFrame, pass it to `px.bar` as its first argument, and then use the `"sepal_length"` column for the x-axis and the `"sepal_width"` for the y-axis.
140+
Here, we create a pandas `DataFrame`, pass it to `px.bar` as its first argument, and then use the `"sepal_length"` column for the x-axis and the `"sepal_width"` for the y-axis.
141141

142142
```python
143143
import plotly.express as px
@@ -150,7 +150,7 @@ fig.show()
150150

151151
### Example: Polars DataFrame with `px.bar`
152152

153-
`px` provides native support for DataFrame types other than pandas:
153+
`px` provides native support for dataframe types other than pandas, including Polars:
154154

155155
```python
156156
import plotly.express as px
@@ -161,9 +161,9 @@ fig = px.scatter(df, x='sepal_length', y='sepal_width', color='species', size='p
161161
fig.show()
162162
```
163163

164-
### Using the Index of a DataFrame
164+
### Using the Index of a Dataframe
165165

166-
If the DataFrame you are using has an index, it is also possible to use that index as an argument. In the following example, the index is used for the hover data.
166+
If the dataframe you are using has an index, it is also possible to use that index as an argument. In the following example, the index is used for the hover data.
167167

168168
```python
169169
import plotly.express as px
@@ -173,9 +173,9 @@ fig = px.scatter(df, x=df.sepal_length, y=df.sepal_width, size=df.petal_length,
173173
fig.show()
174174
```
175175

176-
### Using Columns from Multiple DataFrames
176+
### Using Columns from Multiple Dataframes
177177

178-
You can also use columns from multiple dataframes in one `px` function, as long as all the DataFrame columns you use have the same length. In this example, we pass `df1` as the `data_frame` argument to `px.bar` and then us a column from `df2` for the `y` argument.
178+
You can also use columns from multiple dataframes in one `px` function, as long as all the dataframe columns you use have the same length. In this example, we pass `df1` as the `data_frame` argument to `px.bar` and then us a column from `df2` for the `y` argument.
179179

180180
```python
181181
import plotly.express as px
@@ -233,7 +233,7 @@ fig.show()
233233

234234
### Passing dictionaries or array-likes as the data_frame argument
235235

236-
The column-based argument `data_frame` can also be passed with a `dict` or `array`. Using a dictionary can be a convenient way to pass column names used in axis titles, legend entries and hovers without creating a DataFrame.
236+
The column-based argument `data_frame` can also be passed with a `dict` or `array`. Using a dictionary can be a convenient way to pass column names used in axis titles, legend entries and hovers without creating a dataframe.
237237

238238
```python
239239
import plotly.express as px
@@ -261,7 +261,7 @@ fig.show()
261261

262262
### Mixing dataframes and other types
263263

264-
It is possible to mix DataFrame columns, NumPy arrays and lists as arguments. Remember that the only column names to be used correspond to columns in the `data_frame` argument, use `labels` to override names displayed in axis titles, legend entries or hovers.
264+
It is possible to mix dataframe columns, NumPy arrays and lists as arguments. Remember that the only column names to be used correspond to columns in the `data_frame` argument, use `labels` to override names displayed in axis titles, legend entries or hovers.
265265

266266
```python
267267
import plotly.express as px

0 commit comments

Comments
 (0)