I have pandas dataframe values that I am reading from a csv file. I have a column labeled "SleepQuality", and the values are floating point from 0.0 to 100.0. I want to create a new column called "SleepQualityGroup", where the values from the original btw column 0 - 49 have a value of 0 in the new column, 50 - 59 = 1, 60 - 69 = 2, 70 - 79 = 3, 80 - 89 = 4 and 90 - 100 = 5
What would be the best formula for this? I focused on the logic needed to identify all the values in each range and assign a new value.
An example of what will look in the next column of "SleepQualityGroup", as shown below:
SleepQuality SleepQualityGroup 80.4 4 90.1 5 66.4 2 50.3 1 86.2 4 75.4 3 45.7 0 91.5 5 61.3 2 54 1 58.2 1
source share