The best method to get round that is to seek out a projection that makes the precise a part of the arena that you have an interest in similarly sized. These are referred to as native UTM Coordinate Referencing Systems. Fortunately for us, OSMnx has a approach integrated that may assist us temporarily in finding the right kind native UTM.

Now we’ve got the native UTM, we import our Airbnb knowledge and convert it into the native projection. We do the similar with the unique eating place knowledge we pulled in from OSMnx.

Step 3: Create a Okay-D Tree to Calculate Distances

Finally, we want to iterate thru each and every AirBnb assets and determine what number of eating places there are inside a 10-minute stroll (roughly 1km).

I do that the usage of a Okay-D Tree. Explaining how Okay-D Trees paintings is out of doors the scope of this newsletter, however in brief, they’re a tremendous environment friendly manner of looking out thru our 80,000 AirBnb rooms and 6,000 eating places and understanding which of them are as regards to which. First, we arrange the tree of all eating place issues:

Then we create a serve as which we will be able to carry out on each and every of our Airbnb assets. The serve as will question the tree and in finding the 500 closest eating places at the side of calculating their distances from the Airbnb assets. We use a determine of 500 within the hope that no assets has greater than 500 eating places as regards to it.

And in any case, we arrange a timer and observe the serve as to each and every Airbnb row:

The serve as takes about 90 seconds on 80,000 houses. Lets take a have a look at the effects: air_gdf[[‘id’,’restaurants’]].head(5)

So there you could have it. Now you know the way many eating places there are inside a 10-minute stroll of each and every Airbnb assets 80,000 AirBnb houses. You may just repeat this procedure for bars, retail outlets, subway stations, vacationer hotspots, public parks, and no matter else you suppose would possibly affect the cost of an Airbnb assets — as I did.

In my ultimate XGBoost fashion, as you’ll be able to see beneath, those OSM options (highlighted in purple) ended up being one of the most maximum vital drivers of value in London.

Feature Importance. Produced in Python by Author.

For the entire Jupyter Notebook see here.


Please enter your comment!
Please enter your name here