def plot_category_category(df, col1, col2, path): if len(df[col1].unique()) < len(df[col2].unique()): col1, col2 = col2, col1 file_name = os.path.join(path, col1 + '-' + col2 + '-bar-plot.png') bar_plot(df, col1, hue=col2, file_name=file_name) file_name = os.path.join(path, col1 + '-' + col2 + '-heatmap.png') heatmap(pd.crosstab(df[col1], df[col2]), file_name=file_name)
def plot_single_category(df, col, path): value_counts = df[col].value_counts() # if the categories are more than 50 then this should be ignored # TODO find a better way to visualize this if len(value_counts) > 50: ignore.add(col) else: file_name = os.path.join(path, col + '-bar-plot.png') bar_plot(df, col, file_name=file_name)