Skip to content
Snippets Groups Projects
Commit 926a4545 authored by niklasfranz's avatar niklasfranz
Browse files

Merge branch 'master' of gitup:nifranz/rse-23-group-assignment-shervud-pitawanik-franz

parents 03c47c5e 2133ffe6
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