fusetools.stat_tools.Viz

class fusetools.stat_tools.Viz[source]

Bases: object

Functions for visualizing distributions.

Methods

dist_plot

Creates a histogram of data.

make_plot_tbl

Creates a visualization of a data table next to a plot of the data.

make_plotting_tbl

Create a visualization of a data table + a bar graph.

classmethod dist_plot(df, col, sav_dir='')[source]

Creates a histogram of data.

Parameters
  • df – Pandas DataFrame of data to plot.

  • col – Column to plot on y-axis (bars).

  • sav_dir – Directory to save plot in.

Returns

Saved plot.

classmethod make_plot_tbl(width, height, plot_size, tbl_size, df, col, tgt_col, title, xlabel, ylabel, agg_df, plot_type, yaxis_fmt, xaxis_fmt, stat, font_size)[source]

Creates a visualization of a data table next to a plot of the data. Intended for use in Jupyter Notebook.

Parameters
  • width – Width of plot.

  • height – Height of plot.

  • plot_size – Size of overall plot.

  • tbl_size – Size of data table.

  • df – Pandas DataFrame of Data to plot.

  • col – Dimension column for plot.

  • tgt_col – KPI column for plot.

  • title – Title for plot.

  • xlabel – Xlabel for plot.

  • ylabel – YLabel for plot.

  • agg_df – Pandas DataFrame for data table.

  • plot_type – Type of visualization to plot (box, box_h, scatter, dist, agg_dist)

  • yaxis_fmt – Format for yaxis.

  • xaxis_fmt – Format for xaxis.

  • stat – Type of statistic to add to the plot if box plot (currently only T-Test P-value supported).

  • font_size – Size of font for table.

Returns

Visualization of a data table next to a plot of the data.

classmethod make_plotting_tbl(width, height, plot_size, tbl_size, df_plot, plot_col_x, plot_col_y, plot_col_hue, plot_title, df_tbl, font_size)[source]

Create a visualization of a data table + a bar graph.

Parameters
  • width – Width of plot.

  • height – Height of plot.

  • plot_size – Size of overall plot.

  • tbl_size – Size of data table.

  • df_plot – Pandas DataFrame of data to plot.

  • plot_col_x – Column name to plot on X axis.

  • plot_col_y – Column name to plot on Y axis (bars).

  • plot_col_hue – Color for column on Y axis (bars).

  • plot_title – Title for plot.

  • df_tbl – Pandas DataFrame of data to show in datatable.

  • font_size – Font size for data table.

Returns

Visualization of a data table next to a bar plot of the data.