mercredi 7 octobre 2020

error The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all() [duplicate]

So when i try to sort the rating into 1,0,-1 with the help of this line of code i get error The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

reviews["positivity"] = reviews["rating"].apply(lambda x: 1 if x>3 else(0 if x==3 else -1))

Aucun commentaire:

Enregistrer un commentaire