Dear all,
Replit.com takes more than 5 minutes to edit the 70k-users-dataframe as requested before I can even solve the 4 issues.
Is it a problem with my code to edit the dataframe?
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
# Import data
df = pd.read_csv('medical_examination.csv')
# Add 'overweight' column
df['overweight'] = None
# Normalize data by making 0 always good and 1 always bad. If the value of 'cholestorol' or 'gluc' is 1, make the value 0. If the value is more than 1, make the value 1
for index in df.index:
if df.loc[index, 'cholesterol']==1:
df.loc[index, 'cholesterol']=0
elif df.loc[index, 'cholesterol']>1:
df.loc[index, 'cholesterol']=1
if df.loc[index, 'gluc']==1:
df.loc[index, 'gluc']=0
elif df.loc[index, 'gluc']>1:
df.loc[index, 'gluc']=1