How to preprocess an ordered categorical variable to feed a machine learning algorithm? I have a categorical variable that measures the income of a family:
A: no income
B: Up to $500
C: $500-$700
…
P: $5000-$6000
Q: More than \\\$6000

It seems odd to me that I have to get dummies for this variable, since it's ordered. I wonder if it's better to map the values: {'A': 0, 'B': 1, …, 'Q': 17} so I can input it into the algorithm this values as integer numbers.
What's the proper way of preprocessing this variable to feed an algorithm such as Random Forest or a simple neural network?
One way to do is to use target encoding:

https://medium.com/analytics-vidhya/target-encoding-vs-one-hot-encoding-with-simple-examples-276a7e7b3e64
https://towardsdatascience.com/target-encoding-and-bayesian-target-encoding-5c6a6c58ae8c

(There are a million resources to learn target encoding)
This way your categories will not only be ordered by the number but for the target value (what is at the end what you want, to give better predictions)