1. Learn
  2. /
  3. Courses
  4. /
  5. Python 数据清洗

Connected

Exercise

重新映射类别 II

在上一个练习中,您确定用于重新映射 cuisine_type 列中 'american'、'asian' 和 'italian' 菜系类型拼写错误的距离阈值应为 80。

在本练习中,您将把这些步骤整合起来:对每个正确的菜系类型,使用 fuzywuzzy.process 的 extract() 函数,找出相似度分数大于或等于 80 的匹配项,并将其替换为正确类别。请记住,当使用 process.extract() 将一个字符串与一个字符串数组进行比较时,输出是由元组组成的列表,每个元组的格式为:

(closest match, similarity score, index of match)

restaurants DataFrame 已在您的环境中,您还可以访问包含正确菜系类型('italian'、'asian' 和 'american')的 categories 列表。

Instructions 1/4

undefined XP
    1
    2
    3
    4
  • 返回 restaurants 中 cuisine_type 列的所有唯一值。