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'df = pd.DataFrame()df['timestamp'] = timestampdf['sn'] = sndf['text'] = textdf['favcount'] = fav_countprint dfprint '------'print df['favcount'].max()我似乎找不到任何东西,任何人都可以帮助我朝正确的方向发展吗?I cant seem to find anything on this, can anyone help guide me in the right direction?推荐答案使用 argmax() idxmax()获取最大值的索引.然后您可以使用locUse argmax() idxmax() to get the index of the max value. Then you can use locdf.loc[df['favcount'].idxmax(), 'sn'] argmax() 现在已弃用,切换为 idxmax() 这篇关于 pandas 最大值指数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-12 21:49