Loading...

verticapy.vDataColumn.pie#

vDataColumn.pie(method: str = 'density', of: str | None = None, max_cardinality: int = 6, h: int | float | Decimal = 0, kind: Literal['auto', 'donut', 'rose', '3d'] = 'auto', categoryorder: Literal['trace', 'category ascending', 'category descending', 'total ascending', 'total descending'] = 'trace', chart: PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure | None = None, **style_kwargs) PlottingBase | TableSample | Axes | mFigure | Highchart | Highstock | Figure#

Draws the pie chart of the vDataColumn based on an aggregation.

Parameters#

method: str, optional

The method used to aggregate the data.

  • count:

    Number of elements.

  • density:

    Percentage of the distribution.

  • mean:

    Average of the vDataColumns of.

  • min:

    Minimum of the vDataColumns of.

  • max:

    Maximum of the vDataColumns of.

  • sum:

    Sum of the vDataColumns of.

  • q%:

    q Quantile of the vDataColumns of (ex: 50% to get the median).

It can also be a cutomized aggregation (ex: AVG(column1) + 5).

of: str, optional

The vDataColumn used to compute the aggregation.

max_cardinality: int, optional

Maximum number of distinct elements for vDataColumns to be used as categorical. For these elements, no h is picked or computed.

h: PythonNumber, optional

Interval width of the bar. If empty, an optimized h is computed.

kind: str, optional

The type of pie chart.

  • auto:

    Regular pie chart.

  • donut:

    Donut chart.

  • rose:

    Rose chart.

  • 3d: 3D Pie.

categoryorder: str, optional

How to sort the bars. One of the following options:

  • trace (no transformation)

  • category ascending

  • category descending

  • total ascending

  • total descending

chart: PlottingObject, optional

The chart object to plot on.

**style_kwargs

Any optional parameter to pass to the plotting functions.

Returns#

obj

Plotting Object.

Examples#

Note

The below example is a very basic one. For other more detailed examples and customization options, please see Pie Chart

Let’s begin by importing VerticaPy.

import verticapy as vp

Let’s also import numpy to create a dataset.

import numpy as np

Let’s generate a dataset using the following data.

data = vp.vDataFrame(
    {
        "gender": ['M', 'M', 'M', 'F', 'F', 'F', 'F'],
        "grade": ['A','B','C','A','B','B', 'B'],
    }
)

Now we are ready to draw the plot:

data["grade"].pie()

See also

vDataFrame.hist() : Histogram.
vDataFrame.pie() : Pie Chart.
vDataColumn.bar() : Bar Chart.