How can I retrieve a row by index value from a Pandas DataFrame?
<p>I have created a dataframe and set an index:</p>

<pre><code>df = pd.DataFrame(np.random.randn(8, 4),columns=['A', 'B', 'C', 'D'])
df = df.set_index('A')
</code></pre>

<p>The dataframe looks like this:</p>

<pre><code>                  B         C         D
A
 0.687263 -1.700568  0.140175  1.420394
-0.212621 -0.700442 -0.041497 -1.034021
-0.614214 -0.437313 -0.464493 -1.182492
-0.885062  0.203892 -0.412400 -0.578346
-1.222661  2.014908 -0.463674 -0.378910
 0.132472 -0.389512  0.623531 -0.788556
-1.083620  1.167158 -0.558217 -0.222078
 1.066270 -0.215586 -0.884757 -0.878557
</code></pre>

<p>How do I get the value of B in the row for which <code>A</code> is <code>0.687263</code>?</p>

<p>I've tried:</p>

<pre><code>e = df.loc(0.687263)
</code></pre>

<p>This gives me a <code>LocIndexer</code> object, rather than the row I'd expect (also I'd like to specify that it should be a single row if possible):</p>

<pre><code>&lt;pandas.core.indexing._LocIndexer object at 0x10385e210&gt;
</code></pre>

<p>And if I now try <code>e['B']</code> I get an error. </p>

<p>How do I get the value of B?</p>