Skip to content

Let's keep in touch

Subscribe to our newsletter for timely insights and actionable tips on your real estate journey.

By signing up, you indicate that you agree to the BiggerPockets Terms & Conditions

Posted about 4 years ago

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

Contain 800x800

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.

What is Rentometer API?


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…

Contain 800x800




… based on local rental comparables in the area:

Contain 800x800 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).

Register for an API Key

Supporting Video


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.

Python Tutorial


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 pd

II. Locals & Constants

Next, create a variable where you will store your API key as a string type object.

Contain 800x800

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. 1. API_Key
  2. 2. Address (street, city, state)
  3. 3. Bedrooms
  4. 4. Baths (if more than 1 then 1.5+)
  5. 5. Building type

We then send our parameters in our request to the API.

Contain 800x800

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.

Contain 800x800

We can now more easily read and work with the data.

Contain 800x800

Let’s take it one step further and transform it into a table!

We use pandas to normalize our json file into a table.

Contain 800x800

Now we have our rent estimate data including mean, median, min, max, and more:

Contain 800x800

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 Properties

Follow 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.

Contain 800x800
Contain 800x800


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

Contain 800x800Contain 800x800Contain 800x800


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.

Contain 800x800

Let’s view a single response by indexing the list:

1 2cy Xd Jway Ua Kb Frg Kfq1g


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.

Contain 800x800

We append each list to our original dataframe to view rent estimates per property.

Contain 800x800

Output:

Contain 800x800

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....

Sources



https://www.rentometer.com/ren...




Comments