i want to check if the string data in a series is equal to a given string. but this returns: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
i know that to use and/or i use & / | but i don't understand how to do this with an if statement
for i in range(len(data)): if (data.Sex == 'female'): if data.Survived == 1:
so what i want to do is check if the Sex column is set female for each row in the data set. what is the best way of doing this. here is an example of what the data looks like:
PassengerId,Survived,Pclass,Name,Sex,Age,SibSp,Parch,Ticket,Fare,Cabin,Embarked 1,0,3,"Braund, Mr. Owen Harris",male,22,1,0,A/5 21171,7.25,,S 2,1,1,"Cumings, Mrs. John Bradley (Florence Briggs
i might be doing this all wrong. please tell me if i am.