python - How do I filter a pandas dataframe by the start of the index? -


i have dataframe of form:

code    note     oh2014  oats futures, march 2014, oh2014, cbot hgg2004 copper futures, february 2004, hgg2004, comex brh2014 brazilian real (brl/usd) futures, march 2014, ... f5h2014 pjm ppl zone off-peak calendar-month day-ahead... pdmu2016    miso indiana hub day-ahead peak calendar-month... glg2015 columbia gulf louisiana natural gas (platts if... ssiz2014    coal (api 8) cfr south china (argus/mccloskey)... kcu1997 coffee futures, september 1997, kcu1997, ice fvh2003 5 year treasury note futures, march 2003, fvh2... bok1974 soybean oil futures, may 1974, bok1974, cbot 

where code index.

how can filter returning entries code begins 'oh'?

something this:

df[df.index.str.startswith('oh')] 

Comments

Popular posts from this blog

account - Script error login visual studio DefaultLogin_PCore.js -

xcode - CocoaPod Storyboard error: -