Question: Here, we will use Python libraries GeoPandas and contextily to read and analyze datasets related to Airbnb listings in Barcelona. We will concentrate on visualizing

Here, we will use Python libraries GeoPandas and contextily to read and analyze datasets related to Airbnb listings in Barcelona. We will concentrate on visualizing data on/together with some maps. The datasets can be downloaded from this link (copy-paste the link if it doesn't go there right away). The size of the file is only around 4.5 Mb . Unzip them into your working folder. In other words, your data should be sitting in the Data \subfolder of your working folder.
There are two types of datasets. One is a .geojson file that contains the "geometry" of Barcelona neighborhoods (73 of them). Others are listings of apartments/rooms available for rent on Airbnb at various times. These were downloaded from Airbnb archives and contain information about locations (including which neighborhood), prices, room types, and more.
As always with Python libraries, you will have to work with documentation, especially for visualization tasks. I went over some details in a class lecture, but you still might need to discover certain things by yourself.
This project requires creating a new environment and installing new packages as well as potentially reinstalling some of the old ones. This may require multiple attempts, perhaps updating Anaconda, and/or other packages. Start early!
Task 6.
Read in 'listings_24.csv', 'listings_30.csv', 'listings_33.csv', and 'listings_45.csv' as well. The four csv files are Barcelona listings made at different times. For each of those find
The total number of listings for each neighborhood.
The "density" of listings (total number divided by the area) for each neighborhood.
The median price of listings for each neighborhood.
Note: You may need to "clean" the data so you don't end up with NaNs in your values (e.g. price). If you find situations that produce NaN, deal with it the way you see fit and give a short explanation in a markup cell.
Task 7.
Find the same information as in 6 but this time only use listings for 'Entire home/apt' room type.
The total number of listings for each neighborhood.
The "density" of listings (total number divided by the area) for each neighborhood.
The median price of listings for each neighborhood.
Task 8.
Merge the results in 7 about the "density" and "price" with the dataframe in task 3. In other words, you should have a dataframe with neighborhood information, plus 8 more columns: density_24, density_30, density_33, density_45, price_24, price_30, price_33, price_45.(Suggestion: use pd.merge (one_dataframe, another_dataframe, on= 'sOME_COLUMN_NAME'); or something similar, for example, with 'left_on=' and 'right_on=' instead of just 'on='....join will also work. See some examples here.)
Task 9.(I suggest do this problem LAST, it's not directly related to the ones above)
Create a horizontal bar plot of the Top 10(by "density") neighborhoods in such a way that bars show counts of each Room Type for each neighborhood - stacked barplot. Use only one dataset, say listings_24.csv. First, figure out the top 10 neighborhoods by "density". Then, for those 10 neighborhoods only, find the counts of each room type. Then create a stacked bar plot for those 10 neighborhoods, showing the counts for each room type. Something like this:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!