I have a pandas df with a column called group consisting of three values which are 1,2 and 3.
I am trying to do the following if else statement:
if df.group == 1:
(code here)
elif df.group ==2:
(code here)
else:
(code here)
When I try to run my if else loop it is throwing the following error: ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Do I need to use np.where instead of the if else loop on the dataframe or if there a way to achieve this with the if else loop?