How do we get a particular filtered row as series?
Example dataframe:
>>> df = pd.DataFrame({'date': [20130101, 20130101, 20130102], 'location': ['a', 'a', 'c']})
>>> df
date location
0 20130101 a
1 20130101 a
2 20130102 c
I need to select the row where location
is c
as a series.
I tried:
row = df[df["location"] == "c"].head(1) # gives a dataframe
row = df.ix[df["location"] == "c"] # also gives a dataframe with single row
In either cases I can't the row as series.