I have a Python Pandas Dataframe, in which a column named status
contains three kinds of possible values: ok
, must read x more books
, does not read any books yet
, where x
is an integer higher than 0
.
I want to sort status
values according to the order above.
Example:
name status
0 Paul ok
1 Jean must read 1 more books
2 Robert must read 2 more books
3 John does not read any book yet
I've found some interesting hints, using Pandas Categorical and map but I don't know how to deal with variable values modifying strings.
How can I achieve that?