[70b42d]: / src / cleaning.py

Download this file

16 lines (12 with data), 453 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Caster les types des variables du df dans le type approprié
def convertType(df, intToFloat, floatToInt):
for col in intToFloat:
df[col] = df[col].astype('float64')
for col in floatToInt:
df[col] = df[col].astype('int64')
return df
# Fonction pour filtrer les valeurs aberrantes
def filter_outliers(df, col_limits):
for col, limit in col_limits.items():
df = df[df[col] < limit]
return df