kailo_beewell_dashboard.synthesise_scores
Functions analysing scores for each topic - as part of several files which provide functions for synthesis (creation and aggregation) of data for the dashboard.
Module Contents
Functions
|
Find the sum of the provided columns. If any of the required columns |
|
Reverse scores in the provided array, based on the known min and max of the |
|
Creates scores for each pupil in the provided dataframe, for each of the |
|
This function uses site-level data. Using the mean and count from each |
Generate rag ratings (above, average, below) based on scores |
- kailo_beewell_dashboard.synthesise_scores.sum_score(df)
Find the sum of the provided columns. If any of the required columns contain, NaN, it will just return NaN as the result
Parameters
- dfpandas DataFrame
Dataframe just containing the columns you want to sum
- kailo_beewell_dashboard.synthesise_scores.reverse_score(scores, min, max)
Reverse scores in the provided array, based on the known min and max of the scale of the scores. NaN will remain as NaN.
Parameters
- scoresarray
Array with scores to be reversed
- minint
Minimum possible score
- maxint
Maximum possible score
Returns
Array with scores reversed
- kailo_beewell_dashboard.synthesise_scores.calculate_scores(data)
Creates scores for each pupil in the provided dataframe, for each of the survey topics. Note, when referring to where scores are “set to positive” or “in a positive direction” or a “negative directioN”, this refers to whether the maximum score is a positive or negative outcome.
Parameters
- datapandas dataframe
Pupil-level survey responses
Returns
- datapandas dataframe
Pupil-level survey responses with the addition of topic scores
- kailo_beewell_dashboard.synthesise_scores.score_descriptives(values, counts)
This function uses site-level data. Using the mean and count from each group, it calculates the weighted mean and weighted standard deviation of scores across the groups. It returns this, alongside a count of the pupils and groups included.
Additional information about weighted standard deviation: This normalises weights so they sum 1 (and so they can’t all be 0). It returns the biased variance and is like a weighted version of np.std(). For small samples, may want to alter to unbiased variance. Based on: https://stackoverflow.com/questions/2413522/weighted-standard- deviation-in-numpy
Parameters
- valuespandas series
Dataframe column with the mean scores in each group, NaN removed
- counts: pandas series
Dataframe column with the count of pupils in each group, NaN removed
Returns
- resultpandas Series
Series with each of the calculations, where index if the name of the calculation
- kailo_beewell_dashboard.synthesise_scores.create_rag_ratings(df)
Generate rag ratings (above, average, below) based on scores
Parameters
- dfdataframe
Contains scores by site, and potentially by pupil group too
Result:
- ragdataframe
Dataframe with scores by site, with additional columns providing RAG ratings and descriptives of the score distribution that were used to generate the RAG