I am trying to bucket my own category for the dataset I have. Currently, I have a column rating that is somehow continuous, I want to create a new column called category and its value will depend on the values from rating. here are my codes:
st_df['Category'] = st_df['Rating'].map({(['Rating'] > 89): 4, (['Rating'] < 90): 3,
(['Rating'] < 80): 2, (['Rating'] < 70): 1,
(['Rating'] < 60): 0})
the error I have is: '>' not supported between instances of 'list' and 'int'
Thanks!