Python Pandas-根据其他列中的最小值获取值

Python Pandas-根据其他列中的最小值获取值,python,pandas,Python,Pandas,我有以下数据帧: Q GDP 248 2008q3 14891.6 249 2008q4 14577.0 250 2009q1 14375.0 251 2009q2 14355.6 我想计算GDP最低的Q值 基于这篇文章,我尝试了以下方法: df = df.loc[df['GDP'].min(),'Quarters'].iloc[0] 但是,我收到以下错误消息: TypeError: cannot do label indexin

我有以下数据帧:

      Q        GDP  
248 2008q3  14891.6 
249 2008q4  14577.0 
250 2009q1  14375.0 
251 2009q2  14355.6 
我想计算GDP最低的Q值

基于这篇文章,我尝试了以下方法:

    df = df.loc[df['GDP'].min(),'Quarters'].iloc[0]
但是,我收到以下错误消息:

    TypeError: cannot do label indexing on <class 'pandas.indexes.range.RangeIndex'> with these indexers [14355.6] of <class 'numpy.float64'>
TypeError:无法使用的这些索引器[14355.6]对进行标签索引
任何帮助都将不胜感激

这是:

df.loc[df['GDP'].idxmin()]['Q']
输出:

'2009q2'