Screen Link:
My Code:
def clean(row):
num_death = 0
cols = [‘Death1’, ‘Death2’, ‘Death3’, ‘Death4’, ‘Death5’]
for c in cols:
death = row[c]
if pd.isnull(death) or death == "NO":
continue
elif death == "YES":
num_death += 1
return num_death
true_avengers[“Deaths”] = true_avengers.apply(clean, axis=1)
true_avengers
Replace this line with your code
What I expected to happen:
What actually happened:
Replace this line with the output/error
<!--Enter other details below: -->
I was just wondering what does the row variable stand for?
Is it the dataframe?
A breakdown of the code would be very helpful. I just want to get a better understanding.