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

drop columns

parent a4fa5b0a
No related branches found
No related tags found
No related merge requests found
......@@ -29,7 +29,7 @@ class Dataset:
raw_dataframe
) # for conveneince
dataframe = self.remove_nonaccepting_rows(dataframe)
dataframe = self.treat_outliers(dataframe, 'Hours')
dataframe = self.treat_outliers(dataframe, "Hours")
dataframe["Anxiety_score"] = self.get_combined_anxiety_score(dataframe)
dataframe["Is_narcissist"] = self.get_is_narcissist_col(dataframe)
......@@ -64,13 +64,21 @@ class Dataset:
Returns:
pd.DataFrame: the dataframe.
"""
rows_to_drop = [
"League",
"S. No.",
"Timestamp",
"highestleague",
"earnings",
]
rows_to_drop = (
[
"League",
"S. No.",
"Timestamp",
"highestleague",
"earnings",
"Birthplace",
"Birthplace_ISO3",
]
+ [f"GAD{i}" for i in range(1, 8)]
+ ["GADE"]
+ [f"SWL{i}" for i in range(1, 6)]
+ [f"SPIN{i}" for i in range(1, 18)]
)
return dataframe.drop(rows_to_drop, axis="columns")
def remove_nonaccepting_rows(
......@@ -113,7 +121,7 @@ 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]
......
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