scikit_na.mpl

scikit_na.mpl.plot_corr(data: DataFrame, columns: Sequence[str] | None = None, mask_diag: bool = True, corr_kws: dict = None, heat_kws: dict = None) SubplotBase

Plot a correlation heatmap.

Parameters:
  • data (DataFrame) – Input data.

  • columns (Optional[Sequence[str]], optional) – Columns names.

  • mask_diag (bool = True) – Mask diagonal on heatmap.

  • corr_kws (dict, optional) – Keyword arguments passed to pandas.DataFrame.corr().

  • heat_kws (dict, optional) – Keyword arguments passed to pandas.DataFrame.heatmap().

Returns:

Heatmap AxesSubplot object.

Return type:

matplotlib.axes._subplots.AxesSubplot

scikit_na.mpl.plot_heatmap(data: DataFrame, columns: Sequence[str] | None = None, droppable: bool = True, sort: bool = True, cmap: Sequence[str] | None = None, names: Sequence[str] | None = None, yaxis: bool = False, xaxis: bool = True, legend_kws: dict = None, sb_kws: dict = None) SubplotBase

NA heatmap. Plots NA values as red lines and normal values as black lines.

Parameters:
  • data (DataFrame) – Input data.

  • columns (Optional[Sequence[str]], optional) – Columns names.

  • droppable (bool, optional) – Show values to be dropped by pandas.DataFrame.dropna() method.

  • sort (bool, optional) – Sort DataFrame by selected columns.

  • cmap (Optional[Sequence[str]], optional) – Heatmap and legend colormap: non-missing values, droppable values, NA values, correspondingly. Passed to seaborn.heatmap() method.

  • names (Optional[Sequence[str]], optional) – Legend labels: non-missing values, droppable values, NA values, correspondingly.

  • yaxis (bool, optional) – Show Y axis.

  • xaxis (bool, optional) – Show X axis.

  • legend_kws (dict, optional) – Keyword arguments passed to matplotlib.axes._subplots.AxesSubplot() method.

  • sb_kws (dict, optional) – Keyword arguments passed to seaborn.heatmap() method.

Returns:

AxesSubplot object.

Return type:

matplotlib.axes._subplots.AxesSubplot

scikit_na.mpl.plot_hist(data: DataFrame, col: str, col_na: str, col_na_fmt: str = '"{}" is NA', stat: str = 'density', common_norm: bool = False, hist_kws: dict = None) SubplotBase

Histogram plot to compare distributions of values in column col split into two groups (NA/Non-NA) by column col_na in input DataFrame.

Parameters:
  • data (DataFrame) – Input DataFrame.

  • col (str) – Name of column to compare distributions of values.

  • col_na (str) – Name of column to group values by (NA/Non-NA).

  • col_na_fmt (str) – Legend title format string.

  • common_norm (bool, optional) – Use common norm.

  • hist_kws (dict, optional) – Keyword arguments passed to seaborn.histplot().

Returns:

AxesSubplot returned by seaborn.histplot().

Return type:

SubplotBase

scikit_na.mpl.plot_kde(data: DataFrame, col: str, col_na: str, col_na_fmt: str = '"{}" is NA', common_norm: bool = False, kde_kws: dict = None) SubplotBase

KDE plot to compare distributions of values in column col split into two groups (NA/Non-NA) by column col_na in input DataFrame.

Parameters:
  • data (DataFrame) – Input DataFrame.

  • col (str) – Name of column to compare distributions of values.

  • col_na (str) – Name of column to group values by (NA/Non-NA).

  • col_na_fmt (str) – Legend title format string.

  • common_norm (bool, optional) – Use common norm.

  • kde_kws (dict, optional) – Keyword arguments passed to seaborn.kdeplot().

Returns:

AxesSubplot returned by seaborn.kdeplot().

Return type:

SubplotBase

scikit_na.mpl.plot_stats(na_info: DataFrame, idxstr: str = None, idxint: int = None, **kwargs) SubplotBase

Plot barplot with NA descriptive statistics.

Parameters:
  • na_info (DataFrame) – Typically, the output of scikit_na.describe() method.

  • idxstr (str = None, optional) – Index string labels passed to pandas.DataFrame.loc() method.

  • idxint (int = None, optional) – Index integer labels passed to pandas.DataFrame.iloc() method.

  • kwargs (dict, optional) – Keyword arguments passed to seaborn.barplot() method.

Returns:

Barplot AxesSubplot object.

Return type:

matplotlib.axes._subplots.AxesSubplot

Raises:

ValueError – Raised if neither idxstr nor idxint are passed.