Skip to content
Snippets Groups Projects
Commit 94cf0b59 authored by niklasfranz's avatar niklasfranz
Browse files

feat: added treat_outliers function

parent f17dbf97
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,7 @@ class Dataset:
raw_dataframe
) # for conveneince
dataframe = self.remove_nonaccepting_rows(dataframe)
dataframe = self.treat_outliers(dataframe, 'Hours')
dataframe["Anxiety_score"] = self.get_combined_anxiety_score(dataframe)
dataframe["Is_narcissist"] = self.get_is_narcissist_col(dataframe)
......@@ -112,6 +113,10 @@ class Dataset:
] = "other"
is_competitive_col = self.get_is_competitive_col(dataframe)
return is_competitive_col
def treat_outliers(self, df, colname):
q = df[colname].quantile(0.99)
return df[df[colname] < q]
def get_combined_anxiety_score(self, dataframe: pd.DataFrame) -> pd.Series:
"""Get the combined anxiety score, as a column.
......
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