Q: Why am I not able to select some elements from a list filtered by elements in another list? I have a dataset in which, among other columns, there's 3 columns called CLASS, DURATION and GENDER. 
import pandas as pd
data = pd.read_csv('dataset.csv')
CLASS = data['CLASS']
DURATION = data['DURATION']
GENDER = data['GENDER']

CLASS contains 5 types of entries - blank, 1, 2, 3, 4; DURATION contains either -1 (that signifies some semantic value) or some positive integer; and GENDER contains either M or F. I am able to select the entries in CLASS by GENDER like so:
CLASS[GENDER=='M']

But I am not able to select entries in OCCUP_CLASS for durations of -1 like so:
CLASS[DURATION=='-1']

Why is that? This is the error I get:
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-56-604aed5ebca4> in <module>()
----> 1 CLASS[DURATION=='-1']

c:\users\h473\appdata\local\programs\python\python35\lib\site-packages\pandas\core\series.py in __getitem__(self, key)
    621         key = com._apply_if_callable(key, self)
    622         try:
--> 623             result = self.index.get_value(self, key)
    624 
    625             if not is_scalar(result):

c:\users\h473\appdata\local\programs\python\python35\lib\site-packages\pandas\core\indexes\base.py in get_value(self, series, key)
   2558         try:
   2559             return self._engine.get_value(s, k,
-> 2560                                           tz=getattr(series.dtype, 'tz', None))
   2561         except KeyError as e1:
   2562             if len(self) > 0 and self.inferred_type in ['integer', 'boolean']:

pandas\_libs\index.pyx in pandas._libs.index.IndexEngine.get_value()

pandas\_libs\index.pyx in pandas._libs.index.IndexEngine.get_value()

pandas\_libs\index_class_helper.pxi in pandas._libs.index.Int64Engine._check_type()

pandas\_libs\index_class_helper.pxi in pandas._libs.index.Int64Engine._check_type()

KeyError: False


A: I am not able to reproduce but u can try out 
import pandas as pd
data = pd.read_csv('dataset.csv')
CLASS = data['CLASS']
DURATION = data['DURATION']
GENDER = data['GENDER']

# fill the nan value 
DURATION.fillna(0,inplace=True)
# using astype convert the value to int then compare
CLASS[DURATION].astype(int)>0


A: Maybe best to not split them up as Series to begin with and instead try this on the Dataframe:    
import pandas as pd
data = pd.read_csv('dataset.csv')
data.loc[data['GENDER'] == 'M', 'CLASS']
data.loc[data['DURATION'] == -1, 'CLASS']

