title: Python - Pandas - Multi-index - Generic code to grab last index and the data
body: <p>Assuming the code below:</p>
  
  <pre><code>import pandas as pd
  import datetime
  ticker_date = [('US','AAPL',datetime.date.today()-datetime.timedelta(3)),
  ('US','AAPL',datetime.date.today()-datetime.timedelta(2)),
  ('US','AAPL',datetime.date.today()-datetime.timedelta(1)),
  ('US','MSFT',datetime.date.today()-datetime.timedelta(3)),
  ('US','MSFT',datetime.date.today()-datetime.timedelta(2)),
  ('US','MSFT',datetime.date.today()-datetime.timedelta(1)),
  ('EU','TOT',datetime.date.today()-datetime.timedelta(3)),
  ('EU','TOT',datetime.date.today()-datetime.timedelta(2)),
  ('EU','TOT',datetime.date.today()-datetime.timedelta(1)),
  ('EU','CA', datetime.date.today() - datetime.timedelta(3)),
  ('EU','CA', datetime.date.today() - datetime.timedelta(2)),
  ('EU','CA', datetime.date.today() - datetime.timedelta(1))
  ]
  index_df = pd.MultiIndex.from_tuples(ticker_date)
  example = pd.DataFrame([12.5,20.5,30.4,10.25,1.0,136,12.2,24.7,37.3,15.1,30.4,45.4],index_df,['value'])
  </code></pre>
  
  <p>I am looking for a line of code to get: </p>
  
  <pre><code>df.loc['US'].loc['AAPL'] 
  </code></pre>
  
  <p>in a generic way - Generic meaning that I will apply some methods on my DataFrames, but these DataFrames can have different Index Levels, depending on the situation. If I add a layer, my code could be:</p>
  
  <pre><code>df.loc['EQUITY'].loc['US].loc['AAPL'].
  </code></pre>
  
  <p>The Index Levels are variables. But the objective is always the same, get the dates and the data value. </p>