categorical_summary
- categorical_summary(data: DataFrame, column: str, fig_height: int = 600, fig_width: int = 1200, order: Union[str, List] = 'auto', max_levels: int = 20, flip_axis: Optional[bool] = None, include_missing: bool = False, display_figure: bool = False) Figure
Creates a univariate EDA summary for a provided categorical data column in a pandas DataFrame.
- Parameters
data – pandas DataFrame with data to be plotted
column – column in the dataframe to plot
fig_width – figure width in inches
fig_height – figure height in inches
order –
Order in which to sort the levels of the variable for plotting:
’auto’: sorts ordinal variables by provided ordering, nominal variables by descending frequency, and numeric variables in sorted order.
’descending’: sorts in descending frequency.
’ascending’: sorts in ascending frequency.
’sorted’: sorts according to sorted order of the levels themselves.
’random’: produces a random order. Useful if there are too many levels for one plot.
Or you can pass a list of level names in directly for your own custom order.
max_levels – Maximum number of levels to attempt to plot on a single plot. If exceeded, only the max_level - 1 levels will be plotted and the remainder will be grouped into an ‘Other’ category. size and number of levels.
flip_axis – Whether to flip the plot so labels are on y axis. Useful for long level names or lots of levels. Default tries to infer based on number of levels and label_rotation value.
include_missing – Whether to include missing values as an additional level in the data
display_figure – Whether to display the figure in addition to returning it