I am trying to execute an multiple conditional statement, If the condition passes then only further process can be executed.
I am using AND to concatenate two conditions but it gives error as ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Script that i am using so far:
if df['column1']=='Del Ind' and df['column5'].notna():
i = pd.MultiIndex.from_product((df['state_name'],d))
def f(x) : return Levenshtein.ratio(*x)
out = pd.DataFrame.from_records(i,columns=['Inp','Output']).assign(Score=i.map(f))
out = out.loc[out.groupby('Inp')['Score'].idxmax()]
How to correct this line of code :
if df['column1']=='Del Ind' and df['column5'].notna():
I can execute the code if i am not using the if statement, But while using under if condition it doesn't satisfy.
Please suggest how to execute.
[1,2,3,4,5] > 2? Pandas is flagging the fact that the condition may have multiple (boolean) values as a responseprint(df['column5']); print(df['column5'].notna());