Data Study on Apartments in Manhattan

Posted on Aug 21, 2016
The skills the author demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

Introduction

Manhattan is without a doubt one of the best cities in the world to live in.  Data shows the city is rich in history, culture, art and vibrancy, which never ceases to amaze. It is the city that never sleeps and there is always something to do. Most people want to move to this incredible city and are willing to compromise luxury by living in shoebox apartments and paying crazy-high rent. The rental market in New York is one of the most expensive in the country.  How you chose to live can be as important as WHERE you choose to live. The high volume of demand makes the NYC real estate market very expensive.

Looking for an apartment in Manhattan used to be far more stressful.  However with the arrival of numerous rental websites and apps, house hunting has never been so easy and convenient. Trulia is one of the many online residential real estate websites that gives access to housing information for people interested in renting apartments in the United States.  It lists information such as price, number of bedrooms and bathrooms, school rating and crime level. There is a wide range of housing options which people can chose from.

Data Extraction and Transformation

The structure of the webpages was in 2 different formats for Apartment Community Complex and Individual Apartments. This project only focused on  Individual apartments which had only one type of bedroom and ranged from one-bedroom to seven-bedroom apartments. As you can see in the picture below,  the apartment consisted of only one type of bedroom and the names for the apartments were given on the basis of their location.  Information such as  rent, area, address and geo-location were scraped from the page.Clicking on the apartment name takes you to the webpage which has detailed information about the apartment such as school and crime ratings.

Data Study on Apartments in Manhattan

After developing the code in python, I was able to scrape the information for all apartments in  Manhattan by looping through each page. In total, I scraped data for 6767 individual apartments which were exported into excel. I did some data munging and cleaning to get the data in the proper structure to do further analysis. The apartments were divided into 10 Manhattan neighborhoods based on postal code information.  In total there were 19 variables for each apartment.

Data Study on Apartments in Manhattan

The Rental App

After data preparation, I built a Rental App using R Shiny which displays the apartments on the interactive map from their geo location. The apartments have been classified into 4 classes that are 1 bedroom, 2 bedroom, 3 bedroom and more than 3 bedroom to make visualization more interpretable. The users can filter their apartment search based on neighborhood, number of bedrooms and bathrooms, and rental price. We can get additional information about the apartments by clicking on the points which display pop up boxes with apartment details. Similarly, the small bar-graph shows the frequencies of apartment types that are currently displayed on the interactive maps. We can also view the database of the apartments by clicking on the “Data” tab.

Data Study on Apartments in Manhattan

Analyzing the data

This Shiny app analyzes the data and gives information about total number of apartment types and median prices for each neighborhood in Manhattan.  It gives users the option to select the type of apartment they want to get information about. In the figure below, we analyze one and two bedroom apartments.

20

Analyzing the bar graph for the number of apartments in each neighborhood, we can see that there are more one bedroom apartments than two bedroom apartments in most of the neighborhoods.  This is particularly so in Chelsea Clinton, the Upper East Side, and the Upper West Side.  In contrast, Central and East Harlem have more two bedroom apartments, and the actual number of apartments for rent in these areas is relatively low.

Data Study on Apartments in Manhattan

Looking at the bar-graph of the median prices in each neighborhood, we can see that rent prices for both one bedroom and two bedroom apartments are very high in Lower Manhattan and Chelsea Clinton. Two bedroom apartments are particularly expensive in Lower Manhattan.  It is relatively cheaper to live in East Harlem or the Inwood Washington Heights area. This information can be very useful for the users to plan their rental search based on their budget.

Crime Level

Every potential renter wants to live in a place that is safe for them and their family. Each apartment has crime level ratings based on the number of crime incidents that occurred nearby the apartments. The crime level rating has been categorized into 4 groups (lowest, low, high and highest).

22

We are analyzing only the apartments that have the “highest” and “lowest” crime rating. We can see that there were relatively more apartments on the Upper East Side and Upper West Side that had “lowest” crime level. There were very few apartments in this region that had “highest” crime rating which tells us that these neighborhoods are relatively safe.  On the other hand, there were many apartments in Greenwich Village Soho that had “highest” crime rating and very few “lowest” crime rating. Therefore we can say that it is safer to live on the upper East Side and Upper West Side areas of Manhattan than Greenwich Village Soho.

Data on School Ratings

Each apartment has ratings information for Elementary, Middle and High School based on the average rating of all schools nearby.  These ratings come from “GreatSchools.com”. The ratings have been classified into 3 groups: “Above Average”, “Average” and “Below Average”.

Data on Elementary School Ratings

From the elementary schools bar graph, we can see that there were lots of apartments in the Upper East Side and Gramercy Park Murray Hill that had school ratings “Above Average”. There were more apartments in Inwood Washington Heights which had “Below Average” ratings. Overall there were more apartments with “Above Average” ratings than “Below Average” ratings in most of the neighborhoods.

23

Data on Middle School Ratings

We can see that there were more neighborhoods that had “average” schools, than any other type.  Noteworthy are Gramercy Park and Greenwich Village for their “above average” schools.   While Central Harlem and East Harlem are noteworthy for the lack of any “above average” schools.

24

Data on High School Rating

We can see that there are very few neighborhood that had schools rated as “Above Average”. Most neighborhoods have a higher number of schools rated as “Average” than “Below Average”.  Looking at bar-graphs for Gramercy Park Murray Hill, Inwood Washington Heights and Central Harlem, we can see that there are more schools rated “Below Average” than “Average”.

25

Conclusion

I would like to sum up by stating that this app can be really helpful for the users who are looking to rent apartments in Manhattan. The users can improve their apartment search by filtering apartments according to their needs and playing with the interactive map to gain more insights about apartment rentals. They can also get additional ideas about the price ranges, school ratings and crime level for each neighborhood and decide which neighborhood they want to move to. Happy Apartment Hunting !!!

Future Work

  • Expanding the apartment search to all boroughs of New York
  • Adding more information about the apartments.
  • Adding features to the map
  • Building a multiple regression model to estimate price from different predictor variables

Link to the Shiny App: https://samriddhishakya.shinyapps.io/Trulia/

Link to the codes:

 https://github.com/nycdatasci/bootcamp006_project/tree/master/Project3-WebScraping/Samriddhi_Trulia

About Author

Samriddhi Shakya

Samriddhi comes from a Remote Sensing and Geographic Information Systems (GIS) background. He has a Master’s degree in Geography from Auburn University and Bachelors of Engineering degree in Geomatics from Kathmandu University. During his Masters at Auburn University,...
View all posts by Samriddhi Shakya >

Leave a Comment

Samriddhi Shakya October 5, 2016
Hi Sendy, Can you please elaborate more on the problem you were facing. This app helps you visualize apartments in Manhattan geo-spatially and gives you additional information about the apartments. Please let me know if you have any suggestions to improve this app. Thank you. Sam

View Posts by Categories


Our Recent Popular Posts


View Posts by Tags

#python #trainwithnycdsa 2019 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI