vDataFrame[].pie¶
In [ ]:
vDataFrame[].pie(method: str = "density",
of: str = "",
max_cardinality: int = 6,
h: float = 0,
pie_type: str = "auto",
ax=None,
**style_kwds,)
Draws a pie chart of the vcolumn based on an aggregation.
Parameters¶
| Name | Type | Optional | Description |
|---|---|---|---|
method | str | ✓ | One of the following methods used to aggregate the data:
|
of | str | ✓ | The vcolumn to use to compute the aggregation. |
max_cardinality | int | ✓ | Maximum number of the vcolumn distinct elements to be used as categorical (No h will be picked or computed) |
h | float | ✓ | Interval width of the bar. If empty, an optimized h will be computed. |
pie_type | str | ✓ | The Pie Type.
|
ax | Matplotlib axes object | ✓ | The axes to plot on. |
**style_kwds | any | ✓ | Any optional parameter to pass to the Matplotlib functions. |
In [1]:
from verticapy.datasets import load_titanic
titanic = load_titanic()
display(titanic)
In [3]:
titanic["age"].pie()
Out[3]:
In [4]:
# Only 3 slices, other categories will be merged to create 'others'
titanic["age"].pie(max_cardinality = 3)
Out[4]:
In [5]:
# avg survived partitioned by age
titanic["age"].pie(method = "avg", of = "survived")
Out[5]:
In [7]:
# donut
titanic["pclass"].pie(pie_type = "donut")
Out[7]:
In [8]:
# rose
titanic["pclass"].pie(pie_type = "rose")
Out[8]:
