Python Jumpstart by Building 10 Apps Transcripts
Chapter: App 9: Real Estate Analysis App
Lecture: Introduction to the Real Estate Data Miner App
0:00 It's time for application number 9. This one I am calling the real estate data miner app. So what we are going to do we are going to take
0:09 a whole bunch of historical real estate data feed it to this application, and be able to answer pretty interesting questions
0:15 like what was the average price of a two bedroom house sold in this region during this time, things like that, so what it's going to look like- well,
0:25 you'll see something like this, standard header, and it's going to load up a comma separate value, a csv file of historical real estate data
0:33 and it will detect the header so we'll use this, basically define the columns that we'll use to answer our questions later,
0:41 it can be somewhat dynamic with this, and then we can answer questions like what was the most expensive house sold period,
0:47 well that's some kind of 4 bedroom, 3 bath house for almost million dollars in Wilton And the least expensive house was oh my gosh,
0:55 like a house for a 1500 dollars, 3 bedroom 3 bath in Lincoln. Something is going on there, who knows the history of that one.
1:02 But the average price was 234,000 dollars for 2.9 on average bedroom, 1.8 bath on average, right.
1:10 And if we restrict ourselves to say well let's just talk about only 2 bedroom houses and give me some stats on that,
1:16 well the average price was 165,000 dollars obviously two bedrooms in 2 bedroom house and 1.4 baths.
1:24 So what are we going to focus on when we build this app. The primary thing we are going to look at is something called
1:29 list comprehensions and something very closely related to them called generator expression. These two Pythonic concepts allow you to take
1:38 what would otherwise be loops and condense them down into much shorter, more concise types of set based operations,
1:44 in some sense it will move from procedural programming to declarative programming.
1:48 We also get to look again at the string and representation magic methods, string parsing, we'll specifically look at the csv file format
1:56 but this concept could be applied to many different types of formats really, somewhat like we saw in app number 8,
2:03 we'll be able to use these generator expressions and data pipelines similar to the way we did for generator methods.
2:09 You can think of generator expressions as simplified inline generator methods if you will. Finally, we will get a chance to look at a challenge
2:18 of writing code that has to run on both, on Python 2 and Python 3, as you saw, we are talking about averages and there is a nice statistics module
2:26 that was introduced in Python 3.4, it is not available in Python 2, so what will we do there? Well, you'll see that we can write the same basic code
2:33 and just adjust our imports and make it work.