I currently have a data set with a bunch of different columns listed below stating "No" or "Yes", "Female" or "Male". I wanted to change the No's and Females to 0 and Yes and Males to 1. I included the picture of what I'm trying to do below.
The code doesnt error out but the output I'm getting is below. Please help!
Null = dF.isnull() .any()
dF = dF.drop(["customerID", "gender", "SeniorCitizen", "Partner", "Dependents", "tenure", "PhoneService", "MultipleLines", "InternetService", "OnlineSecurity", "OnlineBackup", "DeviceProtection", "TechSupport", "StreamingTV", "StreamingMovies", "Contract", "PaperlessBilling", "PaymentMethod", "MonthlyCharges", "TotalCharges", "Churn"], axis=1)
for column in range(len(list(dF.columns.values))):
for index, row in dF.iterrows():
if "No" in row[column] or "Female" in row[column]:
dF.iloc[index, column] = 0
elif "Yes" in row[column] or "Male" in row[column]:
dF.iloc[index, column] = 1
dF.to_excel('Cleaned.xlsx', index=False)