Pandas max value index
<p>I have a Pandas DataFrame with a mix of screen names, tweets, fav's etc.  I want find the max value of 'favcount' (which i have already done) and also return the screen name of that 'tweet'</p>

<pre><code>df = pd.DataFrame()
df['timestamp'] = timestamp
df['sn'] = sn
df['text'] = text
df['favcount'] = fav_count


print df
print '------'
print df['favcount'].max()
</code></pre>

<p>I cant seem to find anything on this, can anyone help guide me in the right direction?</p>

<p>use <code>.argmax()</code> to get the index of the max value. then you can use <code>loc</code></p>

<pre><code>df.loc[df['favcount'].argmax(), 'sn']
</code></pre>

python pandas twitter indexing max