How to deal with categorical variables
In your specific case you are working with cities, which can be modelled as geographic location. I've never used it be you could look at the geohash method.

Or could also use an identifiant for each city. An algorithm like a random forest can directly use it this way.