Get startedGet started for free

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.

This exercise is part of the course

Exploratory Data Analysis in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create a list of categories
flight_categories = ____
Edit and Run Code