ritish369 commited on
Commit
eb0f487
·
1 Parent(s): 687e0c0

Commit to ad remaining required files

Browse files
Files changed (1) hide show
  1. preprocessor.py +13 -0
preprocessor.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+
3
+
4
+ def preprocess(df, region_df):
5
+ # Filtering for summer olympics
6
+ df = df[df["Season"] == "Summer"]
7
+ # Merge with region_df
8
+ df = df.merge(region_df, on="NOC", how="left")
9
+ # dropping duplicates
10
+ df.drop_duplicates(inplace=True)
11
+ # one hot encoding medals
12
+ df = pd.concat([df, pd.get_dummies(df["Medal"], dtype="int")], axis=1)
13
+ return df