0

I have a column that has state names "primary_place_of_performance_state_code" I'm trying to find out some of the specific states that I want to do my research.

df[df['primary_place_of_performance_state_code']=='DE']

this gives me just the data for the only 1 state but when I try to compare more states it gives me error

df[df['primary_place_of_performance_state_code']=='DE','DC','MD']

Name: primary_place_of_performance_state_code, Length: 48862, dtype: bool, 'DC', 'MD') Isn't it the right way to compare multiple values within the same column.??

  • @AhmedSunny df[df['primary_place_of_performance_state_code'] in ('DE','DC','MD')]. ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all(). – Abdurrehman rasheed Oct 05 '22 at 08:52

0 Answers0