If there is a more effecient way please let me know.
pk.loc[pk['Type 1'] == 'Grass']
I want to do this but also search with Type 2
being Ground
, but I can't find the syntax.
CodePudding user response:
Try:
pk.loc[(pk['Type 1'] == 'Grass') | (pk['Type 2'] == 'Ground')]
exclusively both:
pk.loc[(pk['Type 1'] == 'Grass') & (pk['Type 2'] == 'Ground')]
CodePudding user response:
In your case do
out = pk.loc[pk['Type 1'].eq('Grass') & pk['Type 2'].eq('Ground')]