Reputation: 141
I have the following dataframe:
Q GDP
248 2008q3 14891.6
249 2008q4 14577.0
250 2009q1 14375.0
251 2009q2 14355.6
I want to the value for Q where GDP is lowest.
Based on this post,extract column value based on another column pandas dataframe, I tried the following:
df = df.loc[df['GDP'].min(),'Quarters'].iloc[0]
However I got this following error msg:
TypeError: cannot do label indexing on <class 'pandas.indexes.range.RangeIndex'> with these indexers [14355.6] of <class 'numpy.float64'>
Any help would be much appreciated!
Upvotes: 6
Views: 9435