Get startedGet started for free

Finding consistency

In this exercise and throughout this chapter, you'll be working with the airlines DataFrame which contains survey responses on the San Francisco Airport from airline customers.

The DataFrame contains flight metadata such as the airline, the destination, waiting times as well as answers to key questions regarding cleanliness, safety, and satisfaction. Another DataFrame named categories was created, containing all correct possible values for the survey columns.

In this exercise, you will use both of these DataFrames to find survey answers with inconsistent values, and drop them, effectively performing an outer and inner join on both these DataFrames as seen in the video exercise. The pandas package has been imported as pd, and the airlines and categories DataFrames are in your environment.

This exercise is part of the course

Cleaning Data in Python

View Course

Hands-on interactive exercise

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

# Print categories DataFrame
print(____)

# Print unique values of survey columns in airlines
print('Cleanliness: ', airlines['cleanliness'].____, "\n")
print('Safety: ', ____, "\n")
print('Satisfaction: ', ____, "\n")
Edit and Run Code