Pandas DataFrame: plot.line() function
DataFrame.plot.line() function
The plot.line() function is used to plot series or DataFrame as lines.
This function is useful to plot lines using DataFrame’s values as coordinates.
Syntax:
DataFrame.plot.line(self, x=None, y=None, **kwargs)
Parameters:
Name | Description | Type/Default Value | Required / Optional |
---|---|---|---|
x | Columns to use for the horizontal axis. Either the location or the label of the columns to be used. By default, it will use the DataFrame indices. | int or str | Optional |
y | The values to be plotted. Either the location or the label of the columns to be used. By default, it will use the remaining DataFrame numeric columns. | int, str, or list of them | Optional |
**kwds | Keyword arguments to pass on to DataFrame.plot(). |
Optional |
Returns: matplotlib.axes.Axes or numpy.ndarray
Return an ndarray when subplots=True.
Example:
Download the Pandas DataFrame Notebooks from here.
Previous: DataFrame.plot.kde() function
Next: DataFrame.plot.pie() function
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/pandas/dataframe/dataframe-plot-line.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics