Skip to content
Snippets Groups Projects
Commit 43f77b90 authored by Sortofamudkip's avatar Sortofamudkip
Browse files

get_combined_anxiety_score()

parent 12180f6f
No related branches found
No related tags found
No related merge requests found
......@@ -17,9 +17,23 @@ class Dataset:
pd.DataFrame: resulting preprocessed dataframe.
"""
dataframe = raw_dataframe.drop(["League"], axis="columns")
dataframe["Anxiety_score"] = self.get_combined_anxiety_score(dataframe)
# more preprocessing goes here
return dataframe
def get_combined_anxiety_score(self, dataframe: pd.DataFrame):
gad_max = 21
gad_min = 0
gad_normalised = (dataframe["GAD_T"] - gad_min) / gad_max
spin_max = 68
spin_min = 0
spin_normalised = (dataframe["SPIN_T"] - spin_min) / spin_max
swl_max = 35
swl_min = 5
swl_flipped = 1 - (dataframe["SWL_T"] - swl_min) / swl_max
combined = (gad_normalised + spin_normalised + swl_flipped) / 3
return combined
def get_dataframe(self) -> pd.DataFrame:
"""A getter function for the dataframe.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment