7.1. Exercises

Practice Operations with Dataframe columns

Instructions:
Running a coding exercise for the first time could take a bit of time for everything to load. Be patient, it could take a few minutes.

When you see ____ in a coding exercise, replace it with what you assume to be the correct code. Run it and see if you obtain the desired output. Submit your code to validate if you were correct.

Let’s split up a column of dtype object.

Tasks:

  • Split up the column Birth Date into 3 separate columns named Birth_Day, Birth_Month and Birth_Year.
  • Name this new dataframe birthdate_df.
  • Save these as columns in the canucks dataframe as dtype int.
Hint 1
  • Are you using str.split('-', expand='True')?
  • Are you saving the columns from the birthdate_df back to the canucks dataframe?
Fully worked solution: