niimpy.exploration.eda.categorical module
Created on Thu Nov 18 14:49:22 2021
@author: arsii
- niimpy.exploration.eda.categorical.categorize_answers(df, question)[source]
Extract a question answered and count different answers.
- Parameters:
- dfPandas Dataframe
Dataframe containing questionnaire data
- questionstr
dataframe column sontaining question id
- answer_columnstr
dataframe column containing the answer
- Returns:
- category_counts: Pandas Dataframe
Dataframe containing the category counts of answers filtered by the question
- niimpy.exploration.eda.categorical.get_xticks_(ser)[source]
Helper function for plot_categories function. Convert series index into xtick values and text.
- Parameters:
- serPandas series
Series containing the categorized counts
- niimpy.exploration.eda.categorical.plot_categories(df, title=None, xlabel=None, ylabel=None, width=900, height=900)[source]
Create a barplot of categorical data
- Parameters:
- dfPandas Dataframe
Dataframe containing categorized data
- titlestr
Plot title
- xlabelstr
Plot xlabel
- ylabelstr
Plot ylabel
- widthinteger
Plot width
- heightinteger
Plot height
- Returns:
- fig: plotly Figure
A barplot of the input data
- niimpy.exploration.eda.categorical.plot_grouped_categories(df, group, title=None, xlabel=None, ylabel=None, width=900, height=900)[source]
Plot summary barplot for questionnaire data.
- Parameters:
- df: Pandas DataFrameGroupBy
A grouped dataframe containing categorical data
- group: str
Column used to describe group
- titlestr
Plot title
- xlabelstr
Plot xlabel
- ylabelstr
Plot ylabel
- widthinteger
Plot width
- heightinteger
Plot height
- Returns:
- fig: plotly Figure
Figure containing barplots of the data in each group
- niimpy.exploration.eda.categorical.question_by_group(df, question, group='group')[source]
Plot summary barplot for questionnaire data.
- Parameters:
- dfPandas Dataframe
Dataframe containing questionnaire data
- questionstr
question id
- answer_columnstr
answer_column containing the answer
- groupstr
group by this column
- Returns:
- dfPandas DataFrameGroupBy
Dataframe a single answers column filtered by the question parameter and grouped by the group parameter
- niimpy.exploration.eda.categorical.questionnaire_grouped_summary(df, question, group='group', title=None, xlabel=None, ylabel=None, width=900, height=900)[source]
Create a barplot of categorical data
- Parameters:
- dfPandas Dataframe
Dataframe containing questionnaire data
- questionstr
question id
- titlestr
Plot title
- xlabelstr
Plot xlabel
- ylabelstr
Plot ylabel
- userBool or str
If str, plot single user data If False, plot group level data
- groupstr
group by this column
- Returns:
- fig: plotly Figure
A barplot of the input data
- niimpy.exploration.eda.categorical.questionnaire_summary(df, question, title=None, xlabel=None, ylabel=None, user=None, width=900, height=900)[source]
Plot summary barplot for questionnaire data.
- Parameters:
- dfPandas Dataframe
Dataframe containing questionnaire data
- questionstr
question id
- titlestr
Plot title
- xlabelstr
Plot xlabel
- ylabelstr
Plot ylabel
- userBool or str
If str, plot single user data If False, plot group level data
- Returns:
- fig: plotly Figure
A barplot summary of the questionnaire