I have a dataframe like this:
Indicator Value Subregion Territory Year
0 Indic1 1115.000000 Southern Asia Afghanistan 2009
1 Indic1 983.000000 Southern Asia Afghanistan 2010
2 Indic2 1231.000000 Southern Asia Afghanistan 2011
...
I want to get the Subregion of a certain row. I can select the row like this:
df.loc[(df['Territory'] == 'Afghanistan') & (df['Year'] == 2009)]
Which, as expected, results in:
Indicator Value Subregion Territory Year
8 Indic1 1115.000000 Southern Asia Afghanistan 2009
Now when I use
df.loc[(df['Territory'] == 'Afghanistan') & (df['Year'] == 2009)]['Subregion']
I would expect the result to be the string Southern Asia. However, what I get is :
13 Southern Asia
Name: Subregion, dtype: object
Why is that and how do I just get the string from this?