vDataFrame.hist¶
In [ ]:
vDataFrame.hist(columns: list,
method: str = "density",
of: str = "",
max_cardinality: tuple = (6, 6),
h: tuple = (None, None),
hist_type: str = "auto",
ax=None,
**style_kwds,)
Draws a histogram of the input vcolumns based on an aggregation.
Parameters¶
| Name | Type | Optional | Description |
|---|---|---|---|
columns | list | ❌ | List of the vcolumns names. The list must have less than 5 elements. |
method | str | ✓ | The method to use to aggregate the data.
|
of | str | ✓ | The vcolumn to use to compute the aggregation. |
h | tuple | ✓ | Interval width of the vcolumns 1 and 2 bars. It is only valid if the vcolumns are numerical. Optimized h will be computed if the parameter is empty or invalid. |
max_cardinality | tuple | ✓ | Maximum number of distinct elements for vcolumns 1 and 2 to be used as categorical (No h will be picked or computed) |
hist_type | str | ✓ | The Histogram Type.
|
ax | Matplotlib axes object | ✓ | The axes to plot on. |
**style_kwds | any | ✓ | Any optional parameter to pass to the Matplotlib functions. |
In [9]:
from verticapy.datasets import load_titanic
titanic = load_titanic()
display(titanic)
In [10]:
titanic.hist(["survived", "pclass"])
Out[10]:
In [12]:
# Avg of survived partitioned by pclass, sex
titanic.hist(["sex", "pclass"], method = "avg", of = "survived")
Out[12]:
In [13]:
# Stacked : Avg of survived partitioned by pclass, sex
titanic.hist(["sex", "pclass"],
method = "avg",
of = "survived",
hist_type = "stacked")
Out[13]:
In [14]:
# Multi Hist
titanic.hist(["age", "fare"],
method = "density",
hist_type = "multi")
Out[14]:
In [15]:
# Avg of survived partitioned by age, fare
# age will be discretized using an interval of 30 years
# fare will be discretized using an interval of 150£
titanic.hist(["age", "fare"],
method = "avg",
of = "survived",
h = (30, 150))
Out[15]:
See Also¶
| vDataFrame.bar | Draws the Bar Chart of the input vcolumns based on an aggregation. |
| vDataFrame.boxplot | Draws the Box Plot of the input vcolumns. |
| vDataFrame.pivot_table | Draws the Pivot Table of vcolumns based on an aggregation. |
