Rentometer API: Get Rental Comps using Python for Real Estate
Python tutorial on how to get rental estimates from local comparable to evaluate real estate investment properties
There are many factors on what makes an investment property a good or bad deal. One metric we can quantify is whether a property cash flows or not.
This answers whether we make money or lose money each month.
is the difference between your rental property income and your rental property expenses
How do we determine what a property would rent for to calculate income? This is where we use local comparables. We can make an educated assumption on fair market rent for the property based on similar rentals in the area.
We can find similar rentals with free tools like Zillow Rental Manager — Price My Rental (detail in this video). However, this is a manual approach that does not allow our analyses to scale across multiple properties.
We can solve this by utilizing rental estimate APIs like Rentometer.
If you would like to jump to running the notebook, you can get the full Python code at the end of this article.
Rentometer uses proprietary technology and data to provide a thorough rent comparison analysis. It provides market rate estimates based on rental listings in the surrounding neighborhood.
Here is an example of what an output of a single property looks like…
… based on local rental comparables in the area:
Prerequisite
The Rentometer API is available to PRO Standard subscribers and each PRO Standard subscription includes 500 API Credits (one API Credit = one API Call).
Follow along in my Python Tutorial if you would like a step-by-step on retrieving rent data for a single property using the Rentometer API.
If you do not have an existing Python environment, then I highly suggest to first clone the notebook (at the bottom of the article).
This will allow you to run the Python code in Google Colab (free!). It is a cloud-based environment that lets you run code without having to install Python locally.
I. Import Packages
The first step is importing the necessary packages.
# HTTP request to API import requests # data wrangling import pandas as pdII. Locals & Constants
Next, create a variable where you will store your API key as a string type object.
III. Request Data
In this sample request, we look to extract data for 15 Broad St, Boston, MA.
The API requires us to send 5 parameters:
- 1. API_Key
- 2. Address (street, city, state)
- 3. Bedrooms
- 4. Baths (if more than 1 then 1.5+)
- 5. Building type
We then send our parameters in our request to the API.
In our response, we receive a dictionary like object outputted as a string of text.
{“address”:”15 Broad Street, Boston, Massachusetts 02109",”latitude”:”42.358729"….}
But this is not easy to read! We want to view the output in a tabular format (rows and columns), so that we can download it as a CSV or excel file.
This is where transforming the data comes into play! :)
IV. Transform Data
Transform the API response to a JSON file — key / value pairs.
We can now more easily read and work with the data.
Let’s take it one step further and transform it into a table!
We use pandas to normalize our json file into a table.
Now we have our rent estimate data including mean, median, min, max, and more:
This code works on a one-off basis. However, to use it at scale we need to modify our code a bit to handle requests for multiple properties.
Multiple PropertiesFollow along in my Python Tutorial if you would like a step-by-step on retrieving rent data for multiple properties using the Rentometer API.
Below we create a dataframe that contains data for two properties (in my home city Tampa!).
You can replace this by reading in your own CSV file of property addresses.
V. Create Function
To request data from the API for multiple properties we need to create a function. The function will take in required parameters and make the request to the API.
There are some nuances with Rentometer’s API, such as:
- Max bedroom option is ‘4’
- Bathrooms greater than 1.5 are labeled as ‘1.5+’
- Lookback days have a min and max value
Luckily for you, I created the function to adjust for those nuances to avoid common errors when running the code for multiple properties.
View API specifications in more detail here
VI. Call API per property
Next, we iterate (loop through) each property in our dataframe. In this case it is just two properties.
For each property (or row), we get the required parameters. We then call our function to get the API response.
Each API response per property is collected in a list called response_list. This allows us to store each response in a single object.
Let’s view a single response by indexing the list:
VII. Transform Data (multiple responses)
Now let’s view all the responses in a single table.
In this case, I only care about the rent estimate values — mean, median, max, and min.
We iterate through each response in our list and extract the rent estimate values. We store each value into a list object.
We append each list to our original dataframe to view rent estimates per property.
Output:
We have successfully retrieved the rent estimate data per property, hooray!
Zapier Integration
Want to take this a step further to integrate the data into other applications? Check out my video on how to do so with Zapier.
Conclusion
The Rentometer API is a great data source to programmatically extract rental comparable data. An investment property analysis can be further improved by retrieving rental data from multiple data sources.
Check out my YouTube channel — AnalyticsAriel to get more insight on real estate data sources and data analytics!
Clone notebook
https://colab.research.google....
https://www.rentometer.com/ren...




Comments