Get Real Estate Property Data using Estated's API | Python Tutorial Part 2
Need to get quality real estate property data to analyze a deal or create an application? In this video, I will cover how to get historical property data for MULTIPLE properties in a Python tutorial using Estated's API.
Transcription
Ariel Herrera 0:00
Hey everyone, In this video, we're going to cover how to use a status API to get historical information on a property. But not just one, multiple properties. This is really useful if say you have a list of different leads, and you want to be able to programmatically get this data for multiple addresses. This is going to help you do that using Python. My name is Ariel Herrera with the analytics erielle channel, where we bridge the gap between real estate and technology. I have a love for data, Python, and real estate. And if you do too, then please subscribe to this channel as well as like this content. So I know to make more of it. Alright, let's get started. So as a refresher, this is part three of a three part series about status API, and part two of the Python tutorial. So in our last video, we went over how we can get status data for a single property. But in reality, how often are you going to be only looking at data for one single property? Probably rarely, or never, usually, it's
a list of properties. So in this example, safe, we had a list of different addresses, possibly owner name and some more information of motivated sellers, we'd want to be able to append or add different columns to our current analysis or Excel file of historical data. So I want to jump back into the Google collab, which if you haven't already, click the link below to be able to get access to this notebook, which is for free. So again, the last video, we went over how to use this API for a single property. And if you don't have already in a state of API, make sure you go to their website to be able to get it. And you do get 100 Free API calls a start off with which is awesome, because a lot of these real estate API's actually don't give you free access the big ones. So this is awesome. Now go into the Google collab, we're jumping down to this case study of finding potential investments. So the idea is you want to run the Stata API through multiple properties, and then evaluate whatever your criteria is for your investment. So in this first case, I'm going to run this and I quickly created a data frame. So a panda's data frame, similar to a table rows and columns, where I have an address, and these two addresses I just inputted up top, these are in Spring Hill, Florida. Next, I need to be able to split out this address because right now we have everything in one the street address, the city, the state and zip code. But if we go back to the original example, for a single property, we could see that a status API requires us to be broken out and sent to the API within different parameters for the street address, city, state and zip code. So I just said here is I decided to break this out a bit more. So for this column call address, I'm splitting it by a comma. So this would give me 12344 different segments. And then now I have a list of those four, I want to grab the first one in that list, which would be Street, the second one, which would be city, third, which would be state, and then zip code and state. As you can see, they're not split by a comma. So what I'm doing here is I'm splitting it further by one step, so that I can split it just by a space, and then grab the first and second element to ultimately get us to this data frame here, where we have our address, then street, city, state and zip code. If you want to understand this a little bit in more detail, you could always just look at pandas Python documentation, there's so much out there on Google, most of what I've learned has always been just on the spot with a project. Great. So now that we have our list of addresses, in this case, just doing it simple, two different addresses. What we then want to do is for each address in our data frame, we have to, we want to set what are our parameters. So this pastes very easy. When we want to set the address, we want to be able to in that row, grab the address column, we do this for each of our parameters, then this part here is a function we're going to do is pass into our function, our API key that stated needs, then our variables that we just assigned, which is our street, our city and our zip code. Once we pass this into the function, I'm going to go back up to this function. It's going to do the same process that we did with the single property, but by doing it in a function, we could loop through it iteratively rather than having to copy and paste this for every single property, so it allows us to really scale and not just Do it on a one off basis. So again, we have our base URL, we have our parameters we're sending in, then we request to be able to get this data from this base URL and we send in the parameters, then we asked to be able to be returned that response back. So I'm going to do now is run this. And we could see I added this print statement. So I'm able to detect when I'm getting the data, what address it's for. And we could see that took less than two seconds. And we were able to get that data for each of these addresses. So it really shows how easy this is to do. And second of all, how est its response time is really fast. So if you want to use their data for an application, maybe live on your website, I highly suggest it to be a good choice. So we can run this to get a little bit more context in our response list. So for every address, once we get that response from the API, we're appending it to this list. So we could have a list of all our responses. That way, if we have 200 different properties we run this through, we now have a list of the data for each of those 200 properties. And in this case, I'm just picking one of those in the list. And just showing how when we transform it to a JSON file, look at the keys, data and structure, that we're able to get the structure information of the property itself. This includes data like how many baths the condition was the foundation type type, in this case, it was concrete, when it was built, we could go even deeper into the areas of the house and what the square footage is. So that could be really useful if maybe you're only targeting to have a certain size for the Lanai are covered porch. Since in Spring Hill, if you're going to try to do an Airbnb, perhaps a lot of people would expect to have that open area, we could see the roof material type as well, the style, which is Gable, or hip, and a little bit more info as well, that it's one single story, which is pretty normal in the Florida area. Now this is really great that we're able to get this information. But again, this is not digestible, I can't right now just copy this and put it into an Excel file. It's friendly programmatically, but not for an analyst perspective. So I created this quick function, which merges Remember, each of these pieces are basically like dictionaries. So we have key value pairs. So in this case, say if I want to get all the information, that's under the address key, the valuation key, and the structure key, what I can do here, which this was a little bit of a deeper concept, but I'm basically running a for loop. And I'm saying for every property that I was able to get a response for, go to the Jason transformer to Jason, then go to these keys and get the data then once you get the data, merge it all which is happening up here in this function. And if I run this, then put it into a data frame, we can see now that we've flattened our data. And we have information on the street address, which we see here, as well as we're going to have information on the valuation for each property, the value high and low. And we're also going to have that structure information that we previously just looked at. So this is awesome, because at this point, we could just download this to Excel, which I showed in a couple of cells above. And we can scale this out to look at lists of properties. And we could really get that detail information which is what makes a status API really special. If you found this tutorial useful, then please like this video as well check out one of my previous courses a real estate list building automation. If you want to be able to get properties for sale, understand how to actually calculate metrics like cash flow, using Python, and then being able to build out an app at the end that you could use to evaluate properties. My name is Ariel Herrera, and please subscribe if you haven't already. Thanks.