ium_478855/create_data.py
ulaniuk 8ddb6d9ee4 1
2022-04-03 21:18:45 +02:00

27 lines
832 B
Python

# -*- coding: utf-8 -*-
import pandas as pd
from sklearn.model_selection import train_test_split
# Data preproccesing
no_shows=pd.read_csv('KaggleV2-May-2016.csv')
# Usunięcie negatywnego wieku
no_shows = no_shows.drop(no_shows[no_shows["Age"] < 0].index)
# Usunięcie kolumn PatientId oraz AppointmentID
no_shows.drop(["PatientId", "AppointmentID"], inplace=True, axis=1)
# Zmiena wartości kolumny No-show z Yes/No na wartość boolowską
no_shows["No-show"] = no_shows["No-show"].map({'Yes': 1, 'No': 0})
# Normalizacja kolumny Age
no_shows["Age"]=(no_shows["Age"]-no_shows["Age"].min())/(no_shows["Age"].max()-no_shows["Age"].min())
X = no_shows.drop(columns=['No-show'])
y = no_shows['No-show']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
print("Quiting create_data.py")