Reputation: 1
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
Reputation: 1939
cleaned[(cleaned['CBF_01']==1) & (cleaned['CBF_01']==2)]
This will give you desired rows from 'cleaned' Dataframe
Upvotes: 3