Sumit Rawat
Sumit Rawat

Reputation: 1

TypeError: unsupported operand type(s) for &: 'float' and 'bool'

import pandas as pd

df = pd.read_csv('NISPUF17.csv')
cleaned = df[['CBF_01','P_NUMFLU']]
(cleaned[cleaned['CBF_01']==1]) & (cleaned[cleaned['CBF_01']==2])

Upvotes: 0

Views: 1570

Answers (1)

Mehul Gupta
Mehul Gupta

Reputation: 1939

cleaned[(cleaned['CBF_01']==1) & (cleaned['CBF_01']==2)]

This will give you desired rows from 'cleaned' Dataframe

Upvotes: 3

Related Questions