w3resource

Pandas DataFrame: plot.pie() function

DataFrame.plot.pie() function

The plot.pie() function is used to generate a pie plot

A pie plot is a proportional representation of the numerical data in a column. This function wraps matplotlib.pyplot.pie() for the specified column. If no column reference is passed and subplots=True a pie plot is drawn for each numerical column independently.

Syntax:

DataFrame.plot.pie(self, **kwargs)

Parameters:

Name Description Type/Default Value Required / Optional
y    Label or position of the column to plot. If not provided, subplots=True argument must be passed.  int or label Optional
**kwds Keyword arguments to pass on to DataFrame.plot().   Required

Returns: matplotlib.axes.Axes or np.ndarray of them
A NumPy array is returned when subplots is True.

Example:


Download the Pandas DataFrame Notebooks from here.

Previous: DataFrame.plot.line() function
Next: DataFrame.plot.scatter() function



Become a Patron!

Follow us on Facebook and Twitter for latest update.

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-pie.php