use loc
So for you example:
df.loc[df.Name == 'Pigeon', 'Category']
would give you what you want
Example:
In [17]:
import io
import pandas as pd
temp = """Type Name Category
Bird Flappy_Bird Air
Bird Pigeon Air
Pokemon Jerry Aquatic
Pokemon Mudkip Aquatic
Animal Lion Terrestrial"""
df = pd.read_csv(io.StringIO(temp), sep='\s+')
df
Out[17]:
Type Name Category
0 Bird Flappy_Bird Air
1 Bird Pigeon Air
2 Pokemon Jerry Aquatic
3 Pokemon Mudkip Aquatic
4 Animal Lion Terrestrial
[5 rows x 3 columns]
In [19]:
df.loc[df.Name == 'Pigeon','Category']
Out[19]:
1 Air
Name: Category, dtype: object
If you have multiple values and just want the first then use idxmin
:
In [24]:
df.ix[(df.Name == 'Pigeon').idxmin(),'Category']
Out[24]:
'Air'
EDIT
So for the case where we have multiple values and you want to access the individual values, you can either check the index values and directly access them:
In [23]:
df.loc[df.Name=='Pigeon','Category'].index.values
Out[23]:
array([1, 5], dtype=int64)
In [26]:
df.loc[df.Name=='Pigeon','Category'][5]
Out[26]:
'Air2'
OR if you want to loop over them then series has a iteritems()
method:
In [28]:
df.loc[df.Name=='Pigeon','Category'].iteritems()
Out[28]:
[(1, 'Air'), (5, 'Air2')]
either of these should satisfy your requirements