Why df[[2,3,4]][2:4] works and df[[2:4]][2:4] does not in Python
Question: suppose we have a datarame

    
    
    import pandas as pd
    df = pd.read_csv('...')
    df
      0 1 2 3 4
    0 1 2 3 4 5
    1 1 2 3 4 5
    2 1 2 3 4 5
    3 1 2 3 4 5
    4 1 2 3 4 5
    

Why one approach is working and other returns syntax error?


Answer: I think you need [`ix`](http://pandas.pydata.org/pandas-
docs/stable/generated/pandas.DataFrame.ix.html):

    
    
    print (df.ix[2:4,2:4])
       2  3
    2  3  4
    3  3  4
    4  3  4
    

