Data Study on Finding Value in NYC Apartments

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


Whether you're new to the Big Apple, or a native Brooklynite, everyone knows that apartment hunting can be a painful hassle. If it's your first time moving to the concrete jungle, it can feel overwhelming trying to figure out what neighborhoods provide the best value, or, ย where can I find data on a flat with four bedrooms for you and your friends? Perhaps you're done with roommates and want to see how much you need to budget in order to get a studio within walking distance of your favorite West Village brunch spot?

Well now with MyShoeBox, you have access to all this information and more with the click of a button. Never again will you have to question your decision to place a deposit on an apartment because the broker says it won't last, because you'll know exactly how many are just like it and how much they cost!

How It Works:

What MyShoeBox does is coalesce all of the data from and bucket it according to each neighborhood. With this data, the user canย see a breakdown of what they can expect to find in each neighborhood, and how much they should expect to pay. This way, when they find the apartment of their dreams, they can have the confidence to make a quick decision.

Data Collection:

The first challenge in building this application is to obtain the data from Streeteasy. To do this, I used the BeautifulSoup application in Python. I initialized a dictionary and then added each apartment as a nested dictionary object inside my original one with the apartments data id as the key. After this, I added the apartment's attributes (beds, baths, square feet, price, neighborhood, coordinates) to the nested dictionary.

Data Study on Finding Value in NYC Apartments

In order to get the bed, bath and square feet, I had to write a second for-loop which iterated over each apartment item and returned tag whose text string matched any of the words 'bed', 'bath' or 'ft'. To do this, I created a variable 'pattern' which returned any of these words if they were found in a string

Data Study on Finding Value in NYC Apartments

and then added that word as an attribute in the apartment dictionary and assigned its value to that attribute. Once I collected all the data in my nested dictionary, I then cleaned the data and converted it to a ย data frame structure and exported it as a file into R, where I could then use it to create the Shiny web application.

Shiny Application Data:

Data Study on Finding Value in NYC Apartments

The user is promoted to select a neighborhood they would like to live in. Once they have made their choice, they are shown the number of apartments available in that neighborhood, The price per square foot, the average price of a studio, and the number of studios available.

Improvements to the application will include asking the user to specify how many rooms they are looking for in an apartment, then being shown how many apartments match their criteria. This way they can compare two-bedroom apartments in West Village versus similar apartments in the East Village, or Tribeca. Additionally, my next steps will includeย adding the top 5 picks on Streeteasy that match the user-defined criteria according to either asking price, or cheapest per square foot.

Screen Shot 2016-05-23 at 11.48.46 PM


This was an exciting project for me because I believe that this information can and will be very helpful to people of all ages and socio-economic statuses in helping them find the very best value with their NYC apartment. Additionally, I was able to combine both Python BeautifulSoup with a Shiny web application in R, and learned how to take a project from start to finish in terms of the data collection, scrubbing and user interface. If you have questions or comments as to how this application could be improved, please feel free to let me know!

About Author

Zachary Escalante

Zach Escalante's path to the field of Data Analysis has not been a conventional one. Born and raised in South Florida, Zach did his first bachelor's degree in Finance at Florida Atlantic University (FAU). Following the completion of...
View all posts by Zachary Escalante >

Related Articles

Leave a Comment

No comments found.

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