Симуляторы iOS 6 в Xcode 5

Вы можете использовать pd.Series.isin .

Для «IN» используйте: something.isin(somewhere)

Или для «NOT IN»: ~something.isin(somewhere)

В качестве обработанного примера:

>>> df
  countries
0        US
1        UK
2   Germany
3     China
>>> countries
['UK', 'China']
>>> df.countries.isin(countries)
0    False
1     True
2    False
3     True
Name: countries, dtype: bool
>>> df[df.countries.isin(countries)]
  countries
1        UK
3     China
>>> df[~df.countries.isin(countries)]
  countries
0        US
2   Germany

29
задан Ricardo Sanchez-Saez 25 September 2014 в 10:10
поделиться