I am new to Data Science and have a problem with categorical variables. My data set has 2 columns of strings - Departure City and Arrival City. It looks like this:
ID | DepCity| ArrCity |Price|Time|SomeColumn |ColToPredict|
1 |London | Berlin | 300 | 95 | 220 | 4 |
2 |Dublin | Nice | 420 |115 | 59 | 1 |
3 |Milan | Brussels| 150 |108 | 154 | 3 |
4 |Paris | Rome | 160 |120 | 200 | 4 |
250 |Madrid | Oslo | 290 |300 | 110 | 2 |
So there are a lot of categorical variables in both columns and these columns are important (their values depend on other columns).
I use Python and sklearn. And it's not possible just to eliminate them as suggested in some tutorials.
I know there is a way to deal with categorical variables by creating new columns with zeros and ones for each variable. But I'm not sure that it's my case, because I have about 30 unique cities in each column. What will be the best way to convert categorical variables into numerical?