Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -78,17 +78,17 @@ def cleaning_features(data):
|
|
78 |
data[numeric_cols] = scaler.transform(data[numeric_cols])
|
79 |
|
80 |
for races in race_categories:
|
81 |
-
if data['race'] ==
|
82 |
-
|
83 |
else:
|
84 |
-
|
85 |
# for N in columns_to_encode:
|
86 |
# race_encoded = encoder.transform(data[[N]])
|
87 |
# race_encoded_cols = encoder.get_feature_names_out([N])
|
88 |
# race_encoded_df = pd.DataFrame(race_encoded, columns=race_encoded_cols, index=data.index)
|
89 |
# # Combine the encoded data with original dataframe
|
90 |
# data = pd.concat([data.drop(N, axis=1), race_encoded_df], axis=1)
|
91 |
-
|
92 |
|
93 |
data = pca(data)
|
94 |
return data
|
|
|
78 |
data[numeric_cols] = scaler.transform(data[numeric_cols])
|
79 |
|
80 |
for races in race_categories:
|
81 |
+
if data['race'] == races:
|
82 |
+
data[f'race_{races}'] = 1
|
83 |
else:
|
84 |
+
data[f'race_{races}'] = 0
|
85 |
# for N in columns_to_encode:
|
86 |
# race_encoded = encoder.transform(data[[N]])
|
87 |
# race_encoded_cols = encoder.get_feature_names_out([N])
|
88 |
# race_encoded_df = pd.DataFrame(race_encoded, columns=race_encoded_cols, index=data.index)
|
89 |
# # Combine the encoded data with original dataframe
|
90 |
# data = pd.concat([data.drop(N, axis=1), race_encoded_df], axis=1)
|
91 |
+
data = data.drop(columns=['race'])
|
92 |
|
93 |
data = pca(data)
|
94 |
return data
|