Question
Background You are a data scientist at Airbnb in charge of analyzing the data about your rental listings. You are getting ready for analyses by
Background
You are a data scientist at Airbnb in charge of analyzing the data about your rental listings. You are getting ready for analyses by doing some minor cleaning and preparing.
Tasks
Using the dataset available below, complete each of the tasks you find in the questions.
1. Import the data found in listings.csv into a Pandas DataFrame.
This dataset contains AirBnB rental listings.
Print the number of rows in this data frame using Python code (i.e. do not simply open the file in Excel and look at the number)
After printing the number of rows, print the first five records
How many rows are in this dataset? ____________
2. We have hired a professional room stager/designer to help our hosts on a limited basis. We need to identify the rental listings with the largest potential profit. Iterate through the rows of this data frame one at a time using the fastest technique taught in this chapter. Print the host_ids, minimum_number of nights, and price for any listing over (or equal to) 14 minimum nights and $1000 price. How many of these listings are in the DataFrame? _______________
3. Let's see exactly how much revenue is generated from each listing for a minimum number of nights stay. Create a new column (without using an iteration) that is equal to the price x minimum_nights. Call this column 'revenue.' Sort the DataFrame by this new column descending. What is the potential revenue of the largest revenue listing? ______________
4. Let's identify these listings in the data frame with a new column called 'design_help'. Create a new column called 'design_help' with the initial value of False for every row. Then, relabel these values to True for any row that meets the criteria above Filter and print the DataFrame showing only those records that are True for this new column. Do not sort or change the order of these records at all. What is the hostname of the third record in this DataFrame? Copy and past it below exactly as it appears: ____________
5. The type of room (Entire home/apt, Private room, Hotel room, Shared room) can explain a lot about the price people are willing to pay. However, we do not have many records labeled as 'Hotel room' or 'Shared room'.Relabel these values to 'Other room' in order to combine them into a single value. Print a dynamic count (meaning it will update if we were to change the data) of the number of 'Other room' after you complete the update. What is that count? ____________
6. Finally, we need to do something about the last_review column. We will not be able to analyze it unless it is in some sort of integer format. Create a new column called 'days_since_last_review' and fill it with the number of days since December 8, 2019. This is the most recent date in this dataset. In other words, the smallest resulting value in this new column will be zero. Print the max value of this new column to indicate the oldest last_review. Although you haven't learned the max() function yet, there are other ways to find the max value. For example, you could sort the dataset descending and return the first-row value. What is this value? In other words, how many days are there from the oldest review date until December 8, 2019? ___________
Fill the box according to the tasks and answer the question below
Task1. Import the data found in listings.csv into a Pandas DataFrame.
This dataset contains AirBnB rental listings.
Print the number of rows in this data frame using Python code (i.e. do not simply open the file in Excel and look at the number)
After printing the number of rows, print the first five records
Task 2. We have hired a professional room stager/designer to help our hosts on a limited basis. We need to identify the rental listings with the largest potential profit. Iterate through the rows of this data frame one at a time using the fastest technique taught in this chapter. Print the host_ids, minimum_number of nights, and price for any listing over (or equal to) 14 minimum nights and $1000 price
Task 3. Let's see exactly how much revenue is generated from each listing for a minimum number of nights stay. Create a new column (without using an iteration) that is equal to the price x minimum_nights. Call this column 'revenue.' Sort the DataFrame by this new column descending
Task 4. Let's identify these listings in the data frame with a new column called 'design_help'. Create a new column called 'design_help' with the initial value of False for every row. Then, relabel these values to True for any row that meets the criteria above
Filter and print the DataFrame showing only those records that are True for this new column. Do not sort or change the order of these records at all.
Task 5. The type of room (Entire home/apt, Private room, Hotel room, Shared room) can explain a lot about the price people are willing to pay. However, we do not have many records labeled as 'Hotel room' or 'Shared room'
Relabel these values to 'Other room' in order to combine them into a single value. Print a dynamic count (meaning it will update if we were to change the data) of the number of 'Other room' after you complete the update.
Task 6. Finally, we need to do something about the last_review column. We will not be able to analyze it unless it is in some sort of integer format. Create a new column called 'days_since_last_review' and fill it with the number of days since December 8, 2019. This is the most recent date in this dataset. In other words, the smallest resulting value in this new column will be zero. Print the max value of this new column to indicate the oldest last_review. Although you haven't learned the max() function yet, there are other ways to find the max value. For example, you could sort the dataset descending and return the first-row value.
Please help me with python coding.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started