I did sort the values. But the problem is 'до 25' (up to 25). How can i change it into '0-25' and calculate correlation coefficient of age group and overall rating.
Some of my data is below
| Age group | Overall rating |
|---|---|
| 65 and older | 38.45 |
| 55-64 | 17.66 |
| up to 25 | 46.56 |
| 45-54 | 24.95 |
| 35-44 | 33.54 |
| 25-34 | 37.21 |
Below is how you can do what you ask. I converted your age categories to mean age because correlation requires two numeric values; a category will not work for correlation. There are some other problems with your data. It is unclear what the 65 and older class really is numerically. I made it 65-100 but that may not be the case. You also have your categories set at 25-34 for example. It should be 25-35 because 25-35 does not contain 35 it contains 25, 26, 27, 28, 29, 30, 31, 32, 33 and 34 which is what I think you are trying to achieve. I did not change this but you should change it if that is what you are trying to achieve.
The resulting df and correlation are: