Remapping categories II
In the last exercise, you determined that the distance cutoff point for remapping typos of 'american'
, 'asian'
, and 'italian'
cuisine types stored in the cuisine_type
column should be 80.
In this exercise, you're going to put it all together by finding matches with similarity scores equal to or higher than 80 by using fuzywuzzy.process
's extract()
function, for each correct cuisine type, and replacing these matches with it. Remember, when comparing a string with an array of strings using process.extract()
, the output is a list of tuples where each is formatted like:
(closest match, similarity score, index of match)
The restaurants
DataFrame is in your environment, and you have access to a categories
list containing the correct cuisine types ('italian'
, 'asian'
, and 'american'
).
This exercise is part of the course
Cleaning Data in Python
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Inspect the unique values of the cuisine_type column
print(____)