Data Interview Qs - Plotting New York Airbnb listings

InterviewQs

Plotting New York Airbnb listings

Python Arrays Data Structures Data Visualization

Forward this email to a friend or colleague and challenge them to solve it.

Hi, 

Can you use this map and this dataset to plot Airbnb listings across New York City by price?

The dataset include the following fields:

  • id: id of the listing
  • name: Name of listing
  • host_id: ID of the host
  • host_name: Name of the host
  • neighbourhood_group: general location of listing
  • neighbourhood: granular location of listing
  • latitude: latitude coordinates of listing
  • longitude: longitude coordinates of listing
  • room_type: type of room for the listing
  • price: price per night for listing
  • minimum_nights: minimum nights required to stay
  • number_of_reviews: number of reviews
  • last_review: date of last review
  • reviews_per_month: number of reviews per month
  • calculated_host_listings_count: number of listings under the host
  • availability_365: number of days the listing is available throughout the year.

Here are a few tips to help get you started:

  • Latitudes and longitudes are included in the dataset, and can be used to create a scatter plot
  • Consider segmenting the data in order to clearly see the price ranges. For example, if the price range for the set is between 100.00 and 10,000.000, but 90% of listings fall under the 500.00 price range, you might want to cap our plot to only showing prices under 500.00
  • You will also only want to include sites that have more than 30 days available to book a year and have at least 1 review

The code below loads in the dataset and a few relevant python libraries. You can also make a copy of this Colab Notebook.

      

# Importing packages

import numpy as np

import pandas as pd

%matplotlib inline

import seaborn as sns

# Need this to import map image and create chart

import urllib

import matplotlib.pyplot as plt

import matplotlib.image as mpimg

# Reading in data

df = pd.read_csv('https://raw.githubusercontent.com/erood/interviewqs.com_code_snippets/master/Datasets/AB_NYC_2019.csv', parse_dates=True)

df.head()

id name host_id host_name neighbourhood_group neighbourhood latitude
0 2539 Clean & quiet apt home by the park 2787 John Brooklyn Kensington 40.64749
1 2595 Skylit Midtown Castle 2845 Jennifer Manhattan Midtown 40.75362
2 3647 THE VILLAGE OF HARLEM....NEW YORK ! 4632 Elisabeth Manhattan Harlem 40.80902
3 3831 Cozy Entire Floor of Brownstone 4869 LisaRoxanne Brooklyn Clinton Hill 40.68514
4 5022 Entire Apt: Spacious Studio/Loft by central park 7192 Laura Manhattan East Harlem 40.79851

Getting started with the map image

      

# Code to get you started with the image

# Setting the figure size

plt.figure(figsize=(10,8))

# Loading NYC image provide in question prompt

i=urllib.request.urlopen('https://raw.githubusercontent.com/erood/interviewqs.com_code_snippets/master/Datasets/Neighbourhoods_New_York_City_Map.png')

nyc_img=plt.imread(i)

# Scaling image based on latitude and longitude min and max for correct output

plt.imshow(nyc_img,zorder=0,extent=[-74.258, -73.7, 40.49,40.92])

ax=plt.gca()

# Plotting our data points on top of the image

### You'll need to insert your own code here #####

Solution will be written in python for premium users.



 

You’ve accumulated 276 questions since joining our email list. Create a premium account to access detailed solutions to each problem (including this one) + our new Case studies.


Was this email forwarded to you? You can join our list here to receive questions

How did you like today's question?

15411 Boischatel, Montreal, QC, H9H1Y7, Canada
Don't want to get these emails anymore? We'll forgive you if you unsubscribe

Key phrases

Older messages

Simulating and visualizing rolls of a die

Monday, April 4, 2022

Python, Arrays, Data Structures, Algorithms, Simulation, Data Visualization, InterviewQs Simulating and visualizing rolls of a die Python Arrays Data Structures Algorithms Simulation Data Visualization

A/B testing a new landing page

Friday, April 1, 2022

Python, Product Questions, Data Structures, Pandas, Data Analysis, Statistics, InterviewQs A/B testing a new landing page Python Product Questions Data Structures Pandas Data Analysis Statistics

Top online order locations by revenue

Wednesday, March 30, 2022

SQL, Database Querying, Window Function, Subquery, InterviewQs Top online order locations by revenue SQL Database Querying Window Function Subquery Forward this email to a friend or colleague and

Probability of sitting in the aisle based on the plane ticket's letter

Monday, March 28, 2022

Python, Probability, Data Structures, Pandas, Data Analysis, Data Visualization, InterviewQs Probability of sitting in the aisle based on the plane ticket's letter Python Probability Data

Words from keyboard rows

Friday, March 25, 2022

Python, Arrays, Data Structures, Algorithms, InterviewQs Words from keyboard rows Python Arrays Data Structures Algorithms Forward this email to a friend or colleague and challenge them to solve it. Hi

You Might Also Like

Python Weekly - Issue 647

Thursday, April 25, 2024

View this email in your browser Python Weekly Welcome to issue 647 of Python Weekly. Let's get straight to the links this week. From Our Sponsor Get Your Weekly Dose of Programming A weekly

Web Tools #562 - Voilà Review, CSS Tools, Media, React Native

Thursday, April 25, 2024

WEB VERSION Issue #562 • April 25, 2024 The following is a paid product review for Voilà, an AI assistant for the browser that enables you to improve your writing, coding, brainstorming, and research

Everyone wants to build the AI dev tool of the future

Thursday, April 25, 2024

A new startup called Augment has raised north of $250 million to build AI-powered dev tools. View this email online in your browser By Alex Wilhelm Thursday, April 25, 2024 Welcome to TechCrunch AM!

7 reasons to use Copilot over ChatGPT

Thursday, April 25, 2024

Coros Vertex 2S; Top 5 news apps; New Yeedi M12 Pro+ -- ZDNET ZDNET Tech Today - US April 25, 2024 placeholder 7 reasons I use Copilot instead of ChatGPT I reach for Copilot every day, and here's

Why they signed up for my Private AI Mentorship

Thursday, April 25, 2024

There are 3 reasons: use cases, accountability, and time. ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌ ‌

wpmail.me issue#664

Thursday, April 25, 2024

wpMail.me wpmail.me issue#664 - The weekly WordPress newsletter. No spam, no nonsense. - April 24, 2024 Is this email not displaying correctly? View it in your browser. News & Articles WordPress

📧 Modular Monolith Architecture is now LIVE! 🎉

Thursday, April 25, 2024

​ MMA is now LIVE! The day has finally come. ​Modular Monolith Architecture is now open for enrollment. ​ I can't wait for you to see everything I prepared! 10 in-depth chapters 60+ high-quality

Testing the Rabbit R1's AI assistant

Thursday, April 25, 2024

The Morning After It's Thursday, April 25, 2024. Back in January, startup Rabbit revealed its first device at CES 2024. The R1 is an adorable, vibrant orange AI machine with a camera, scroll wheel,

Zero-Day Alert: State-Sponsored Hackers Exploting Two Cisco Flaws for Espionage

Thursday, April 25, 2024

THN Daily Updates Newsletter cover Coding with AI For Dummies ($18.00 Value) FREE for a Limited Time Boost your coding output and accuracy with artificial intelligence tools Download Now Sponsored

Post from Syncfusion Blogs on 04/25/2024

Thursday, April 25, 2024

New blogs from Syncfusion How BoldSign Improved HR Operations at Syncfusion By Syncfusion HR Team Let's see how Syncfusion's BoldSign revolutionizes HR operations with seamless document