kailo_beewell_dashboard.reshape_data
Helper functions for reshaping data or extracting a certain element from the data, often used across multiple different pages
Module Contents
Functions
|
Filter dataframe so just contains rows relevant for chosen group (either |
|
Extract lists of results that were stored in dataframe. |
|
Get the total pupil number for a given school |
- kailo_beewell_dashboard.reshape_data.filter_by_group(df, chosen_group, output, chosen_school=None, chosen_variable=None, survey_type='standard')
Filter dataframe so just contains rows relevant for chosen group (either results from all pupils, or from the two chosen groups) and school
Parameters
- dfdataframe
Dataframe to be filtered
- chosen_groupstring
The group for results to be viewed by - one of: ‘For all pupils’, ‘By year group’, ‘By gender’, ‘By FSM’, or ‘By SEN’
- outputstring
Defines where data will be used - either ‘explore’ or ‘summary’
- chosen_schoolstring
Optional input, name of a school to filter to as well
- chosen_variablestring
Optional input, name of a variable to filter to as well
- survey_typestring
Designates whether this filtering is for ‘standard’ or ‘symbol’ survey
Returns
Depends on chosen output
- kailo_beewell_dashboard.reshape_data.extract_nested_results(chosen, group_lab=None, plot_group=False)
Extract lists of results that were stored in dataframe. e.g. [‘Yes’, ‘No’], [20, 80], [2, 8] in the original data will become seperate columns with [Yes, 20, 2] and [No, 80, 8]
Parameters
- chosendataframe
Dataframe with the nested lists to be extracted
- group_labstring
Name of chosen group (e.g. gender_lab, fsm_lab) - optional input, default None.
- plot_groupboolean
Whether there is a plot_group column to include - default False.
- kailo_beewell_dashboard.reshape_data.get_school_size(counts, school, survey_type='standard')
Get the total pupil number for a given school
Parameters
- countsdataframe
Dataframe containing the count of pupils at each school
- schoolstring
Name of the school
- survey_typestring
Designates whether this filtering is for ‘standard’ or ‘symbol’ survey
Returns
- school_sizeinteger
Total number of pupils at school (who answered at least one question)