1. Learn
  2. /
  3. Courses
  4. /
  5. Exploratory Data Analysis in Python

Exercise

Flight duration categories

As you saw, there are 362 unique values in the "Duration" column of planes. Calling planes["Duration"].head(), we see the following values:

0        19h
1     5h 25m
2     4h 45m
3     2h 25m
4    15h 30m
Name: Duration, dtype: object

Looks like this won't be simple to convert to numbers. However, you could categorize flights by duration and examine the frequency of different flight lengths!

You'll create a "Duration_Category" column in the planes DataFrame. Before you can do this you'll need to create a list of the values you would like to insert into the DataFrame, followed by the existing values that these should be created from.

Instructions 1/2

undefined XP
    1
    2
  • Create a list of categories containing "Short-haul", "Medium", and "Long-haul".