1# create a list of our conditions
2conditions = [
3 (df['likes_count'] <= 2),
4 (df['likes_count'] > 2) & (df['likes_count'] <= 9),
5 (df['likes_count'] > 9) & (df['likes_count'] <= 15),
6 (df['likes_count'] > 15)
7 ]
8
9# create a list of the values we want to assign for each condition
10values = ['tier_4', 'tier_3', 'tier_2', 'tier_1']
11
12# create a new column and use np.select to assign values to it using our lists as arguments
13df['tier'] = np.select(conditions, values)
14
15# display updated DataFrame
16df.head()