I have a series of data (climbing routes and their grades.)
pd.DataFrame({'route':['Easy route', 'The hard', 'Another route'], 'grade':['9a+', '6c', '7b+']})
| route | Grade |
|---|---|
| Easy route | 9a+ |
| The Hard | 6c |
| Another route | 7b+ |
Grades are strings (non numerical), but can be easily converted to numerical data. Example:
def convert(grade):
grades = ['6b+', '6c', '6c+', '7a', '7a+', '7b', '7b+', '7c', '7c+', '8a', '8a+', '8b', '8b+', '8c', '8c+', '9a', '9a+']
return grades.index(grade)
Table like such:
pd.DataFrame({'route':['Easy route', 'The hard', 'Another route'], 'grade':[16, 6, 1]})
route grade
0 Easy route 16
1 The hard 6
2 Another route 1
Can be plotted with ease. What I want is a plot with the original grades, like this. What is the workaround for non numerical data?
Easy route *************************************
The hard ************
Another route *****************************
6a 6a+ 6b 6c 6c+ 7a 7a+ 7b 7b+ ... 9a+

plt.bar(x=df.route, height=df.grade)?