Get startedGet started for free

Keeping it descriptive

To further understand travelers' experiences in the San Francisco Airport, the quality assurance department sent out a qualitative questionnaire to all travelers who gave the airport the worst score on all possible categories. The objective behind this questionnaire is to identify common patterns in what travelers are saying about the airport.

Their response is stored in the survey_response column. Upon a closer look, you realized a few of the answers gave the shortest possible character amount without much substance. In this exercise, you will isolate the responses with a character count higher than 40 , and make sure your new DataFrame contains responses with 40 characters or more using an assert statement.

The airlines DataFrame is in your environment, and pandas is imported as pd.

This exercise is part of the course

Cleaning Data in Python

View Course

Exercise instructions

  • Using the airlines DataFrame, store the length of each instance in the survey_response column in resp_length by using .str.len().
  • Isolate the rows of airlines with resp_length higher than 40.
  • Assert that the smallest survey_response length in airlines_survey is now bigger than 40.

Hands-on interactive exercise

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

# Store length of each row in survey_response column
resp_length = ____

# Find rows in airlines where resp_length > 40
airlines_survey = airlines[____ > ____]

# Assert minimum survey_response length is > 40
assert ____.str.len().____ > _____

# Print new survey_response column
print(airlines_survey['survey_response'])
Edit and Run Code