feat: prepare

This commit is contained in:
Jakub Zaręba 2023-05-23 21:53:08 +02:00
parent b0f3b59cb3
commit e7907303fc

20
prepare_data.py Normal file
View File

@ -0,0 +1,20 @@
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
def prepare_data(file_path):
data = pd.read_csv(file_path, sep=';')
data = pd.get_dummies(data, columns=['Sex', 'Medal'])
data = data.drop(columns=['Name', 'Team', 'NOC', 'Games', 'Year', 'Season', 'City', 'Sport', 'Event'])
data = data.fillna(0)
scaler = MinMaxScaler()
data = pd.DataFrame(scaler.fit_transform(data), columns=data.columns)
return data
if __name__ == "__main__":
file_path = 'olympics-124-years-datasettill-2020/Data.csv'
data = prepare_data(file_path)
data.to_csv('processed_data.csv', index=False)