Skip to content

EDA Toolkit 0.0.7

Compare
Choose a tag to compare
@lshpaner lshpaner released this 10 Aug 01:54
· 105 commits to main since this release

Add flex_corr_matrix function for customizable correlation matrix visualization

This release introduces a new function, flex_corr_matrix, which allows users to generate both full and upper triangular correlation heatmaps with a high degree of customization. The function includes options to annotate the heatmap, save the plots, and pass additional parameters to seaborn.heatmap().

Summary of Changes:

  • New Function: flex_corr_matrix
    • Functionality:
      • Generates a correlation heatmap for a given DataFrame.
      • Supports both full and upper triangular correlation matrices based on the triangular parameter.
      • Allows users to customize various aspects of the plot, including colormap, figure size, axis label rotation, and more.
      • Accepts additional keyword arguments via **kwargs to pass directly to seaborn.heatmap().
      • Includes validation to ensure the triangular, annot, and save_plots parameters are boolean values.
      • Raises an exception if save_plots=True but neither image_path_png nor image_path_svg is specified.

Usage:

# Full correlation matrix example
flex_corr_matrix(df=my_dataframe, triangular=False, cmap="coolwarm", annot=True)

# Upper triangular correlation matrix example
flex_corr_matrix(df=my_dataframe, triangular=True, cmap="coolwarm", annot=True)

Contingency table df to object type

Convert all columns in dataframe to object, to prevent issues with numerical columns.

df = df.astype(str).fillna("")