Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Cleaning Data in Python

Cursus bekijken

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Print categories DataFrame
print(____)

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