pyspark.pandas.DataFrame.plot.pie¶
-
plot.
pie
(**kwds)¶ Generate a pie plot.
A pie plot is a proportional representation of the numerical data in a column. This function wraps
plotly.express.pie()
for the specified column.- Parameters
- yint or label, optional
Label or position of the column to plot. If not provided,
subplots=True
argument must be passed (matplotlib-only).- **kwds
Keyword arguments to pass on to
pandas-on-Spark.Series.plot()
.
- Returns
plotly.graph_objs.Figure
Return an custom object when
backend!=plotly
. Return an ndarray whensubplots=True
(matplotlib-only).
Examples
For Series:
>>> df = ps.DataFrame({'mass': [0.330, 4.87, 5.97], ... 'radius': [2439.7, 6051.8, 6378.1]}, ... index=['Mercury', 'Venus', 'Earth']) >>> df.mass.plot.pie()
For DataFrame:
>>> df = ps.DataFrame({'mass': [0.330, 4.87, 5.97], ... 'radius': [2439.7, 6051.8, 6378.1]}, ... index=['Mercury', 'Venus', 'Earth']) >>> df.plot.pie(y='mass')