Learn
Modifying DataFrames
Review

Great job! In this lesson, you learned how to modify an existing DataFrame. Some of the skills you’ve learned include:

  • Adding columns to a DataFrame
  • Using lambda functions to calculate complex quantities
  • Renaming columns

Let’s practice what you just learned!

Instructions

1.

Once more, you’ll be the data analyst for ShoeFly.com, a fictional online shoe store.

More messy order data has been loaded into the variable orders. Examine the first 5 rows of the data using print and head.

2.

Many of our customers want to buy vegan shoes (shoes made from materials that do not come from animals). Add a new column called shoe_source, which is vegan if the materials is not leather and animal otherwise.

3.

Our marketing department wants to send out an email to each customer. Using the columns last_name and gender create a column called salutation which contains Dear Mr. <last_name> for men and Dear Ms. <last_name> for women.

Here are some examples:

last_name gender salutation
Smith Male Dear Mr. Smith
Jones Female Dear Ms. Jones
Folder Icon

Sign up to start coding

Already have an account?