niimpy.exploration.eda.countplot module

Created on Mon Nov 8 14:42:18 2021

@author: arsii

niimpy.exploration.eda.countplot.barplot_(df, fig_title, xlabel, ylabel)[source]

Plot a barplot showing counts for each subjects

A dataframe must have columns named ‘user’, containing the user id’s, and ‘values’ containing the observation counts.

Parameters:
dfPandas Dataframe

Dataframe containing the data

fig_titlestr

Plot title

xlabelstr

Plot xlabel

ylabelstr

Plot ylabel

Returns:
niimpy.exploration.eda.countplot.boxplot_(df, fig_title, points='outliers', y='values', xlabel='Group', ylabel='Count', binning=False)[source]

Plot a boxplot

Parameters:
dfPandas Dataframe

Dataframe containing the data

fig_titlestr

Plot title

pointsstr

If ‘all’, show all observations next to boxplots If ‘outliers’, show only outlying points The default is ‘outliers’

y: str

A dataframe column to plot

xlabelstr

Plot xlabel

ylabelstr

Plot ylabel

Returns:
niimpy.exploration.eda.countplot.calculate_bins(df, binning)[source]

Calculate time index based bins for each observation in the dataframe.

Parameters:
dfPandas DataFrame
binningstr
to_stringbool
Returns:
binspandas period index
niimpy.exploration.eda.countplot.countplot(df, fig_title, plot_type='count', points='outliers', aggregation='group', user=None, column=None, binning=False)[source]

Create boxplot comparing groups or individual users.

Parameters:
dfpandas DataFrame

A DataFrame to be visuliazed

fig_titlestr

The plot title.

plot_typestr

If ‘count’, plot observation count per group (boxplot) or by user (barplot) If ‘value’, plot observation values per group (boxplot) The default is ‘count’

aggregationstr

If ‘group’, plot group level summary If ‘user’, plot user level summary The default is ‘group’

userstr

if given … The default is None

columnstr, optional

if None, count number of rows. If given, count only occurances of that column. The default is None.

Returns:
niimpy.exploration.eda.countplot.get_counts(df, aggregation)[source]

Calculate datapoint counts by group or by user

Parameters:
dfPandas DataFrame
aggregationstr
Returns:
n_eventsPandas DataFrame