title: Pandas Multi Index, Hierarchical Index
body: <pre><code>import pandas as pd
  df=pd.read_csv('&lt;https://gist.githubusercontent.com/justmarkham/19241df07db2b93283fbb0cfe9c572f9/raw/f70931bd9f25c560b330f017f6933073c442c7ed/stocks.csv&gt;')
  df2=df.set_index(['Symbol','Date'])
  df2.sort_index(inplace=True)
  print(df2)
  
  s = df.loc[ ('AAPL','2016-10-05') :('MSFT','2016-10-03') ]
  print(s)
  </code></pre>
  
  <p>My DataFrame is per below:</p>
  
  <pre><code>                    Close    Volume
  Symbol    Date                        
  AAPL   2016-10-03  112.52  21701800
         2016-10-04  113.00  29736800
         2016-10-05  113.05  21453100
  CSCO   2016-10-03   31.50  14070500
         2016-10-04   31.35  18460400
         2016-10-05   31.59  11808600
  MSFT   2016-10-03   57.42  19189500
         2016-10-04   57.24  20085900
         2016-10-05   57.64  16726400
  </code></pre>
  
  <p>I have below 2 questions.</p>
  
  <p>1) My requirement is to get the data from the last row in AAPL (i.e. date = '2016-10-05') till the first row in MSFT (i.e. date = '2016-10-03'.</p>
  
  <p>I wrote the below code</p>
  
  <pre><code>df.loc [('AAPL','2016-10-05'):('MSFT','2016-10-03')]
  </code></pre>
  
  <p>However, I am getting the error: AssertionError: Start slice bound is non-scalar.</p>
  
  <p>**Note: My above code is inline to the documentation example: In[44] from <a href="https://pandas.pydata.org/pandas-docs/stable/user_guide/advanced.html" rel="nofollow noreferrer">here</a>.</p>
  
  <p>2) In the 2nd case, I want the data from the middle row (i.e. date of 2016-10-04) of CSCO till the end of dataframe (that is all the rows of MSFT) and only the column: Volume.</p>
  
  <p>Appreciate if you point me where I went wrong.</p>
  
  <p>Thank you
  Srikanth</p>