application_vnd.jupyter.stderr_output_1.png
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

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

duplicates_P = df[df.duplicated(['PatientId'])]
if duplicates_P.empty:
    print('There are no duplicates in the PatientId')
else:
    print(f'There are {len(duplicates)} duplicates in the PatientId')
    df.drop_duplicates(subset=['PatientId'], keep='first', inplace=True)
    print(f'Removed {len(duplicates) - len(df)} duplicates')
duplicates_A = df.duplicated(subset='AppointmentID', keep='first')
if duplicates_A.sum() > 0:
    df.drop_duplicates(subset='AppointmentID', keep='first', inplace=True)
    print(f'{duplicates.sum()} duplicates found and removed.')
else:
    print('There are no duplicates in the AppointmentID')