0

I have a list of valid queue numbers.

valid_queues=[470,471,472,473,474,475,476,477,478,479,490,497]

I want to remove the rows which has queue numbers NOT present in this list.

df.drop(df[df['Queue'] not in valid_queues].index, inplace = True)

The above code is giving an error :

ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().

Where am I going wrong?

Ynjxsjmh
  • 28,441
  • 6
  • 34
  • 52
Soumya Pandey
  • 321
  • 3
  • 19
  • 2
    `df['Queue'] not in valid_queues` should be replaced with `~df['Queue'].isin(valid_queues)` – mozway May 04 '23 at 09:00

0 Answers0