1# filter rows in a dataframe by a condition on a column
2
3df_filtered = df.loc[df['column'] == value]
1# does year equals to 2002?
2# is_2002 is a boolean variable with True or False in it
3>is_2002 = gapminder['year']==2002
4>print(is_2002.head())
50 False
61 False
72 False
83 False
94 False
10# filter rows for year 2002 using the boolean variable
11>gapminder_2002 = gapminder[is_2002]
12>print(gapminder_2002.shape)
13(142, 6)
1# does year equals to 2002?
2# is_2002 is a boolean variable with True or False in it
3>is_2002 = gapminder['year']==2002
4>print(is_2002.head())
50 False
61 False
72 False
83 False
94 False
10