Reputation: 1350
I have a dataset like this:
Country
, Gdp
, Year
, Capital
, Labor
.
It has data from 1950
to 2014
, but I want extract data from all rows with year = 2000
.
I'm using python , pandas and numpy.
Upvotes: 1
Views: 5232
Reputation: 862581
IIUC you can use boolean indexing:
print df
Country Gdp Year Capital Labor
0 a 40 2001 s 40
1 b 30 2000 u 70
2 c 70 2008 t 50
print df[df['Year'] == 2000]
Country Gdp Year Capital Labor
1 b 30 2000 u 70
Upvotes: 3