image_output_1.png
import matplotlib.pyplot as plt

import pandas as pd

import seaborn as sns

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
base_color = sns.color_palette()[0]

data_df = pd.read_csv('/kaggle/input/noshowappointments/KaggleV2-May-2016.csv')

data_df.isnull().sum()

data_df.dtypes

data_df.duplicated().sum()

cleaned_data = data_df.copy()

cleaned_data.rename(columns={'Hipertension': 'Hypertension'}, inplace=True)

neg_age_idx = cleaned_data[cleaned_data['Age'] < 0].index.tolist()
cleaned_data.drop(neg_age_idx, inplace=True)
cleaned_data.reset_index(drop=True, inplace=True)

cleaned_data.dtypes

cleaned_data.dtypes

cleaned_data.dtypes

appointment_df = cleaned_data[['AppointmentID', 'PatientId', 'ScheduledDay', 'AppointmentDay', 'SMS_received', 'No-show']]
patient_df = cleaned_data[['PatientId', 'Gender', 'Age', 'Neighbourhood', 'Scholarship', 'Hypertension', 'Diabetes', 'Alcoholism', 'Handcap']]

patient_df.duplicated().sum()

patient_df.drop_duplicates(inplace=True)
patient_df.reset_index(drop=True, inplace=True)

patient_df.duplicated().sum()

appointment_df.to_csv('Appointment_Data.csv', index=False)
patient_df.to_csv('Patient_Data.csv', index=False)

sns.catplot(x='Gender', data=patient_df, kind='count', color=base_color)
plt.xlabel("Patient's Gender")
plt.ylabel('Count')
plt.title("Patient's Gender Distribution")
plt.show()