ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I have been trying for the whole day and totally wear off. Appreciate if someone can help.

I have a dataframe with only labels and1 row of data as below. I want to change the value in batch. Example if answer is Yes, change to 1. If answer is No, change to 0. How can I do that?

I tried to use python replace function but error message is dont have replace function. So I convert to a single array and try to use if-elif statement to change. But the error message is to use a.any() or a.all(). How to use that? Below is my code:

error2

It should be if i == 'Male' or i == 'No'

Thanks it works.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.