cleanup of feature eng
Browse files- feature_engineering.py +4 -3
feature_engineering.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
|
2 |
################ Dicts with encodings ################
|
3 |
-
|
|
|
4 |
|
5 |
sex_dict = {"female": 1, "male": 0}
|
6 |
embarked_dict = {"S": 0, "C": 1, "Q": 2}
|
@@ -85,10 +86,10 @@ def feat_eng(df):
|
|
85 |
# pd.cut(df['SibSp'], [0,1,2,7], right=False)
|
86 |
|
87 |
# Cabin into categories based on first letter(deck of boat)
|
88 |
-
df["Cabin"] = df["Cabin"].str.slice(0,1)
|
89 |
|
90 |
# Make a separate category of all te NANs
|
91 |
-
df["Cabin"] = df["Cabin"].fillna("N")
|
92 |
|
93 |
# Fixes for hopsworks...
|
94 |
df.columns = df.columns.str.lower()
|
|
|
1 |
|
2 |
################ Dicts with encodings ################
|
3 |
+
# cabin_dict= "Cabin": {"N": 0, "C": 1, "E": 2, "G": 3, "D":4, "A": 5, "B": 6, "F": 7, "T": 8}
|
4 |
+
cleanup_catergories = {"sex": {"female": 1, "male": 0}, "embarked": {"S": 0, "C": 1, "Q": 2}}
|
5 |
|
6 |
sex_dict = {"female": 1, "male": 0}
|
7 |
embarked_dict = {"S": 0, "C": 1, "Q": 2}
|
|
|
86 |
# pd.cut(df['SibSp'], [0,1,2,7], right=False)
|
87 |
|
88 |
# Cabin into categories based on first letter(deck of boat)
|
89 |
+
# df["Cabin"] = df["Cabin"].str.slice(0,1)
|
90 |
|
91 |
# Make a separate category of all te NANs
|
92 |
+
# df["Cabin"] = df["Cabin"].fillna("N")
|
93 |
|
94 |
# Fixes for hopsworks...
|
95 |
df.columns = df.columns.str.lower()
|