How to get value by multi-index with python pandas?
<p>How can I get the value from a dataframe by its multi-index?</p>

<p>For example I have a dataframe <code>mm</code>:</p>

<pre><code>np.random.seed(1)
mm = pd.DataFrame(np.random.randn(5,2))
mm['A'] = np.arange(5)
mm['B'] = np.arange(5,10)
mm.set_index(['A','B'], inplace=True)

print mm

        0         1
A B                    
0 5  1.624345 -0.611756
1 6 -0.528172 -1.072969
2 7  0.865408 -2.301539
3 8  1.744812 -0.761207
4 9  0.319039 -0.249370
</code></pre>

<p>I want to get the value where A = 2, B = 7, how can I do that?</p>

<p>Is it possible to write a function like <code>get_value(mm, (2,7))</code>, then I can get the following result: </p>

<pre><code>2 7  0.865408 -2.301539
</code></pre>