Skip to content

Instantly share code, notes, and snippets.

@jfriedly
Created April 30, 2013 01:32
Show Gist options
  • Save jfriedly/5486100 to your computer and use it in GitHub Desktop.
Save jfriedly/5486100 to your computer and use it in GitHub Desktop.
How to get the rows of a Pandas DataFrame where a column equals something

I loaded in ArcaCMD_LS_20061229.csv and I wanted to get all the trades involving AAON. The way to get them ended up being:

arca = pd.read_csv('ArcaCMD_LS_20061229.csv')
# This creates a Series of booleans
aaon_bool = arca['symbol'] == 'AAON'
# You can access rows given a series of booleans
aaon = arca[aaon_bool]
print len(aaon)
print aaon[10]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment