How to resolve:Python error: "cannot compare a dtyped [float64] array with a scalar of type [bool]"

pandas
dataframe
python

#1

I’m facing a peculiar issue. I’m trying to filter a pandas dataframe using criteria across multiple columns.

Here is the code snipet:
data.loc[passID,“CoupleTravel”] = len(data_tckt[data_tckt[“FamilyName”]==fn & data_tckt[“Age”]<15] & data_tckt[“Title”]==2)

I’m getting an error: cannot compare a dtyped [float64] array with a scalar of type [bool]

I’m not comparing any boolean variable here. Any help would be great!

Thanks,
Aarshay


#2

Hi @Aarshay

Can you share the first 10 rows of DataFrame.

Regards