I have data from different restaurants which have also address of the restaurants now I want to predict the food delivery timing based on the given data, now the restaurant address is one of the crucial data which I need to predict the food delivery timing, now my problem is the address is in string format so how do I handle this address to feed the data in the ML model. I have a total of 35 unique addresses if I do one-hot encoding my dataset will be very large and it will take too much time to train, is there anyway except one-hot encoding to handle the addresses of restaurants.

Data Sample- enter image description here


2 Answers 2


You can convert each address to a pair of geographical coordinates (latitude, longitude). In this way, you'll have a rough measure of the distance between different location. This can be done with Google Maps, for example.

I suggest you to use compute Manhattan distance between locations, in order to properly estimate travel times within a city.


Geocode !

There are API's with decent limits to free daily calls using which you can convert each individual address in the world to a ( Lat , Lon ) point. These Lat - Lon points can then be used to either do some geographical analysis or otherwise as suggested above , to find travel distances using Manhattan distance to use in an ML Model. The lat - Lon can also help you develop many interesting Insightsa dn also correlate to other Datasets.

You could also group your adresses into Primary City Regions that you can then use to estimate delivery times.

Sharing names of a few Geocoding API's

Map My India

Google Maps

Hope this works for you !


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.