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

drop earnings col

parent 376fe7cf
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,13 @@ class Dataset:
pd.DataFrame: resulting preprocessed dataframe.
"""
dataframe = raw_dataframe # for conveneince
rows_to_drop = ["League", "S. No.", "Timestamp", "highestleague"]
rows_to_drop = [
"League",
"S. No.",
"Timestamp",
"highestleague",
"earnings",
]
# rows_to_drop = []
dataframe = raw_dataframe.drop(rows_to_drop, axis="columns")
dataframe = self.remove_nonaccepting_rows(dataframe)
......@@ -34,9 +40,26 @@ class Dataset:
dataframe["Is_narcissist"] = self.get_is_narcissist_col(dataframe)
self.preprocess_whyplay(dataframe)
dataframe["Is_competitive"] = self.get_is_competitive_col(dataframe)
# more preprocessing goes here
return dataframe
def get_is_competitive_col(self, dataframe: pd.DataFrame):
# print(len(dataframe))
is_competitive_col = np.zeros(shape=len(dataframe))
is_competitive_col[
(dataframe["whyplay"] == "improving")
| (dataframe["whyplay"] == "winning")
| (dataframe["whyplay"] == "all of the above")
] = True
is_competitive_col[
(dataframe["whyplay"] == "having fun")
| (dataframe["whyplay"] == "relaxing")
] = False
is_competitive_col[(dataframe["whyplay"] == "other")] = None
return is_competitive_col
def remove_nonaccepting_rows(self, dataframe: pd.DataFrame):
# drop rows where users did not accept to having their data used
dataframe = dataframe.drop(
......
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