Practice DataFrame Mutations using Airbnb Data
Practice DataFrame Mutations using Airbnb Data Data Science Project
Intro to Pandas for Data Analysis

Practice DataFrame Mutations using Airbnb Data

In this lab, you'll dive into the fascinating realm of real estate data using the Airbnb Listings Dataset. Get ready to unleash the power of Pandas as you learn to create, modify, and analyze data frames. Master essential skills like creating new columns, deleting rows and columns, modifying values, adding new rows, and utilizing the inplace parameter. Through hands-on coding activities, tackle real-world challenges and extract valuable insights from the data. Level up your data manipulation skills and become a Pandas pro in this immersive lab. Let's embark on this data-driven adventure together!
Start this project
Practice DataFrame Mutations using Airbnb DataPractice DataFrame Mutations using Airbnb Data
Project Created by

Anurag Verma

Project Activities

All our Data Science projects include bite-sized activities to test your knowledge and practice in an environment with constant feedback.

All our activities include solutions with explanations on how they work and why we chose them.

codevalidated

Create a New Column `price_per_night`

Create a new column called price_per_night that calculates the price per night for each Airbnb listing.

codevalidated

Delete all rows where the price is greater than $500

Modify the original DataFrame df.

codevalidated

Delete the `host_name` and `neighbourhood_group` columns from the DataFrame `df`

Modify the original DataFrame df.

codevalidated

Rename the column `number_of_reviews` to `reviews_count`

codevalidated

Convert the `price` column from integer to float data type

codevalidated

Replace all occurrences of `Private room` in the `room_type` column with `Private`

codevalidated

Add new row with the given details

Add a new row to the DataFrame df at the end with the following details:

new_row_data = {'id': 12345, 'name': 'Cozy Studio Apartment', 'host_id': 67890, 'room_type': 'Entire home/apt',
                'price': 150, 'minimum_nights': 3, 'number_of_reviews': 10}
codevalidated

Remove the `availability_365` column from the DataFrame without creating a new DataFrame

codevalidated

Sort the DataFrame by the `price` column in descending order

Sort the DataFrame df by the price column in descending order and assign the result to sorted_df.

codevalidated

Convert all prices from US dollars to euros

Create a new column price_eur in the DataFrame df that contains the prices in euros. The conversion rate is 1 US dollar = 0.85 euros.

codevalidated

Calculate the total price of nights for each listing by multiplying `minimum_nights` with `price_per_night`

Create a new column total_nights_price in the DataFrame df that contains the total price of nights for each listing. The total price of nights is calculated by multiplying the minimum_nights column with the price_per_night column.

codevalidated

Create a new column named `first_word` that contains the first word from the `name` column

For splitting a string into a list of words, you can use the split() function. The split() function returns a list of words. To access the first word in the list, you can use indexing. For example, text.split().str[0] returns the first word from the name column.

codevalidated

Create a new column named `year` that contains the year information from the `last_review` column

Create a new column year in the DataFrame df that contains the year information from the last_review column. For example, if the last_review column contains the date 2019-05-21, the year column should contain the value 2019. You can use the dt accessor to access the datetime properties of a column. For example, df['last_review'].dt.year returns the year information from the last_review column.

Practice DataFrame Mutations using Airbnb DataPractice DataFrame Mutations using Airbnb Data
Project Created by

Anurag Verma

What's up, friends! 👋 I'm a computer science student about to finish my last year of college. 🎓 I LOVE writing code! ❤️ It makes me so happy! 😄 Whether I'm goofing in notebooks 📓 or coding in Python 🐍, writing programs is a blast! 💥

What's up, friends! 👋 I'm a computer science student about to finish my last year of college. 🎓 I LOVE writing code! ❤️ It makes me so happy! 😄 Whether I'm goofing in notebooks 📓 or coding in Python 🐍, writing programs is a blast! 💥

This project is part of

Intro to Pandas for Data Analysis

Explore other projects