s
This commit is contained in:
parent
7d0cef3a54
commit
1918917126
@ -1,20 +1,16 @@
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
from sklearn.preprocessing import MinMaxScaler
|
from sklearn.preprocessing import MinMaxScaler
|
||||||
|
|
||||||
def prepare_data(file_path):
|
data_path = 'data.csv'
|
||||||
data = pd.read_csv(file_path, sep=';')
|
processed_data_path = 'processed_data.csv'
|
||||||
|
|
||||||
data = pd.get_dummies(data, columns=['Sex', 'Medal'])
|
data = pd.read_csv(data_path, sep=';')
|
||||||
data = data.drop(columns=['Name', 'Team', 'NOC', 'Games', 'Year', 'Season', 'City', 'Sport', 'Event'])
|
|
||||||
|
|
||||||
data = data.fillna(0)
|
data = pd.get_dummies(data, columns=['Sex', 'Medal'])
|
||||||
scaler = MinMaxScaler()
|
|
||||||
data = pd.DataFrame(scaler.fit_transform(data), columns=data.columns)
|
|
||||||
|
|
||||||
return data
|
data = data.drop(columns=['Name', 'Team', 'NOC', 'Games', 'Year', 'Season', 'City', 'Sport', 'Event'])
|
||||||
|
|
||||||
if __name__ == "__main__":
|
scaler = MinMaxScaler()
|
||||||
file_path = 'olympics-124-years-datasettill-2020/Data.csv'
|
data = pd.DataFrame(scaler.fit_transform(data), columns=data.columns)
|
||||||
data = prepare_data(file_path)
|
|
||||||
|
|
||||||
data.to_csv('processed_data.csv', index=False)
|
data.to_csv(processed_data_path, index=False)
|
||||||
|
48565
processed_data.csv
Normal file
48565
processed_data.csv
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user