Q:

np.r_ does not work with 2 ranges or many slices

My dataframe shapes (199, 7). I want to select the columns which are column 0:4 and -2: (which is two last columns). I want to get the rows of the columns selected which the [final_data['unemployed']=='yes']. My columns are 
['panicattacks', 'compulsivebehavior', 'depression', 'anxiety','tiredness', 'unemployed', 'cluster']

My first trial returns error ValueError: special directives must be the first entry.

final_data[np.r_[final_data.columns[0:4],final_data.columns[2]]][final_data['unemployed']=='yes']

My Second trial somehow it cannot work (perhaps it's because of the .iloc, please correct me if i'm wrong)

final_data.iloc[:,np.r_[0:4,-2:]][final_data['unemployed']=='yes'] 

Why don't they work? How should i do it?

A:

This is the kind of expression that produces your error message.  I don't see it in your samples:
In [158]: np.r_[1:3, '-1']                                                                             
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-158-0b702ddf8054> in <module>
----> 1 np.r_[1:3, '-1']

/usr/local/lib/python3.6/dist-packages/numpy/lib/index_tricks.py in __getitem__(self, key)
    358             elif isinstance(item, str):
    359                 if k != 0:
--> 360                     raise ValueError("special directives must be the "
    361                             "first entry.")
    362                 if item in ('r', 'c'):

ValueError: special directives must be the first entry.

testing your r_ in a simpler context:
In [151]: import pandas as pd                                                                          
In [152]: df = pd.DataFrame(np.arange(21).reshape(3,7))                                                
In [153]: df                                                                                           
Out[153]: 
    0   1   2   3   4   5   6
0   0   1   2   3   4   5   6
1   7   8   9  10  11  12  13
2  14  15  16  17  18  19  20

In [154]: np.r_[df.columns[0:4],df.columns[2]]                                                         
Out[154]: array([0, 1, 2, 3, 2])
In [155]: df[np.r_[df.columns[0:4],df.columns[2]]]                                                     
Out[155]: 
    0   1   2   3   2
0   0   1   2   3   2
1   7   8   9  10   9
2  14  15  16  17  16

and
In [150]: np.r_[0:4,-2:-1]                                                                                               
Out[150]: array([ 0,  1,  2,  3, -2])
In [156]: df.iloc[:,np.r_[0:4,-2:-1]] 
     ...:  
     ...:                                                                                              
Out[156]: 
    0   1   2   3   5
0   0   1   2   3   5
1   7   8   9  10  12
2  14  15  16  17  19

I'm not quite sure what 2nd range you want.  Keep in mind that with r_, negative ranges are tricky, r_ does not know the size of df.columns.
edit
[154] works because my sample dataframe had numeric column headers.  Change that to strings:
In [173]: df = pd.DataFrame(np.arange(21).reshape(3,7),columns=list('abcdefg'))                        
In [174]: df                                                                                           
Out[174]: 
    a   b   c   d   e   f   g
0   0   1   2   3   4   5   6
1   7   8   9  10  11  12  13
2  14  15  16  17  18  19  20

In [176]: df[np.r_[df.columns[0:4],df.columns[2]]]                                                     
....
ValueError: special directives must be the first entry.

It's the r_ that's raising the error:
In [177]: np.r_[df.columns[0:4],df.columns[2]]                                                         
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-177-c0b1d20ac1a7> in <module>
----> 1 np.r_[df.columns[0:4],df.columns[2]]

/usr/local/lib/python3.6/dist-packages/numpy/lib/index_tricks.py in __getitem__(self, key)
    358             elif isinstance(item, str):
    359                 if k != 0:
--> 360                     raise ValueError("special directives must be the "
    361                             "first entry.")
    362                 if item in ('r', 'c'):

ValueError: special directives must be the first entry.

the problem is the first argument, an array of strings:
In [178]: df.columns[0:4]                                                                              
Out[178]: Index(['a', 'b', 'c', 'd'], dtype='object')

Looks like the simplest way around this is to use hstack (or just 'concatenate) instead ofr_.  This list doesn't needr_'s` special handling of slices:
In [182]: np.hstack((df.columns[0:4],df.columns[2]))                                                   
Out[182]: array(['a', 'b', 'c', 'd', 'c'], dtype=object)

In [183]: df[np.hstack((df.columns[0:4],df.columns[2]))]                                               
Out[183]: 
    a   b   c   d   c
0   0   1   2   3   2
1   7   8   9  10   9
2  14  15  16  17  16

