{
  "schemaVersion": 1,
  "id": "2.1.5",
  "title": "健康与营养咨询数据预处理与数据规范设计",
  "durationMinutes": 20,
  "category": "数据清洗与标注",
  "scenario": "在健康与营养咨询领域，客户的健康数据是评估其饮食和生活方式建议的重要依据。通过对客户健康数据的分析，可以帮助健康咨询师更准确地评估客户的健康状况，并制定个性化的营养和健康管理计划。现提供一份健康咨询客户数据集。请补全2.1.5.ipynb代码，完成下面的数据预处理任务：\n\n（1）加载数据集：查看表的数据类型，表结构和显示每一列的空缺值数量；\n\n（2）去掉列名中的空格；\n\n（3）缺失值处理：对于含有缺失值的列，进行适当的填充或删除操作；\n\n（4）数据类型转换：将“Your age”列的数据类型转换为整数类型，并处理其中的异常值；\n\n（5）数据去重：检查数据集中的重复值并删除所有重复值，并记录删除的行数；\n\n（6）数据归一化处理：对“如何形容你的当前健身水平？”（How do you describe your current level of fitness ?）列中的数据进行归一化处理；\n\n（7）绘制健身频率分布的饼图；\n\n（8）对数据进行标注划分；\n\n（9）保存处理后的数据，并命名为：2.1.5_cleaned_data.csv，保存到考生文件夹；\n\n（10）制定数据清洗和数据标注规范，将答案写到答题卷文件中，答题卷文件命名为“2.1.5.docx”，保存到考生文件夹；\n\n（11）将以上代码以及运行结果，以html格式保存并命名为2.1.5.html，保存到考生文件夹，考生文件夹命名为“准考证号+身份证后6位”。",
  "skillRequirements": "（1）能够结合人工智能技术要求和业务特征，设计数据清洗和标注流程；\n\n（2）能够结合人工智能技术要求和业务特征，制定数据清洗和标注规范。",
  "qualityIndicators": "（1）深入理解业务，训练符合业务需求的模。",
  "tasks": [
    {
      "id": "code-fill",
      "type": "code-fill",
      "title": "补全代码任务",
      "instructions": "依据公开题面和附件补全代码空位；仅检查完成度与提交格式，不公开标准内容。",
      "codeBlocks": [
        "import pandas as pd\n\n# 加载数据集\ndata = __________\n\n# 查看表结构基本信息\nprint(__________)\n\n# 显示每一列的空缺值数量\nprint(__________)\n\n# 删除含有缺失值的行\ndata_cleaned = __________\n\n# 转换 'Your age' 列的数据类型为整数类型，并处理异常值\ndata_cleaned.loc[:, 'Your age'] = __________(__________, errors='coerce')\ndata_cleaned = data_cleaned.dropna(subset=['Your age'])\ndata_cleaned = data_cleaned[data_cleaned['Your age'] >= 0]\ndata_cleaned.loc[:, 'Your age'] = data_cleaned['Your age'].__________\n\nprint(data_cleaned['Your age'].dtype)\n\n# 检查和删除重复值\nduplicates_removed = data_cleaned.duplicated().sum()\ndata_cleaned = __________\n\nprint(f\"Removed {duplicates_removed} duplicate rows\")\n\nfrom sklearn.preprocessing import LabelEncoder\n\n# 归一化 'How do you describe your current level of fitness ?' 列\nlabel_encoder = LabelEncoder()\ndata_cleaned[__________] = __________\n\nprint(data_cleaned['How do you describe your current level of fitness ?'].unique())\n\nfrom sklearn.preprocessing import LabelEncoder\nimport matplotlib.pyplot as plt\n\n# 去掉列名中的空格\ndata.columns = data.columns.str.strip()\n# 显示数据集的列名\nprint(data.columns)\n\n# 删除包含缺失值的行\ndata_cleaned = data.dropna(subset=['How often do you exercise?'])\n\n# 统计不同健身频率的分布情况\nexercise_frequency_counts = data_cleaned['How often do you exercise?'].value_counts()\n\nimport matplotlib\nimport pandas as pd\nfrom sklearn.model_selection import train_test_split\nimport matplotlib.pyplot as plt\n\n# 绘制饼图\nplt.figure(figsize=(10, 6))\n__________(autopct='%1.1f%%', startangle=90, colors=plt.cm.Paired.colors)\nplt.title('Distribution of Exercise Frequency')\nplt.ylabel('')\nplt.show()\n\n\n\n# 填充缺失值\ndata_filled = data.apply(lambda x: x.fillna(x.mode()[0]))\n\n# 划分数据（测试集占比20%）\ntrain_data, test_data = __________(__________, random_state=42)\n\n# 保存处理后的数据\ncleaned_file_path = '__________'\n__________(__________, index=False)\n"
      ],
      "blanks": [
        {
          "id": "blank-1",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-2",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-3",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-4",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-5",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-6",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-7",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-8",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-9",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-10",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-11",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-12",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-13",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-14",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-15",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        },
        {
          "id": "blank-16",
          "block": 1,
          "placeholder": "__________",
          "gradingMode": "completion-and-format-only"
        }
      ]
    },
    {
      "id": "2-1-response",
      "type": "rubric-response",
      "title": "清洗与标注说明",
      "instructions": "说明清洗、标注、复核及输出质量。",
      "sections": [
        {
          "id": "response",
          "label": "作答内容"
        }
      ],
      "rubric": [
        {
          "id": "criterion-1",
          "label": "缺失、重复和异常处理合理",
          "weight": 25
        },
        {
          "id": "criterion-2",
          "label": "标注规则一致且可追溯",
          "weight": 25
        },
        {
          "id": "criterion-3",
          "label": "包含抽检或质量复核机制",
          "weight": 25
        },
        {
          "id": "criterion-4",
          "label": "输出满足题面质量指标",
          "weight": 25
        }
      ]
    },
    {
      "id": "artifact-submission",
      "type": "artifact-submission",
      "title": "选择结果文件",
      "instructions": "文件仅在本机选择并校验，不上传，也不持久化文件内容。",
      "items": [
        {
          "id": "artifact-1",
          "label": "提交文件：2.1.5_cleaned_data.csv",
          "filename": "2.1.5_cleaned_data.csv",
          "extensions": [
            ".csv"
          ],
          "minCount": 1,
          "maxCount": 1,
          "maxSize": 104857600
        },
        {
          "id": "artifact-2",
          "label": "提交文件：2.1.5.docx",
          "filename": "2.1.5.docx",
          "extensions": [
            ".docx"
          ],
          "minCount": 1,
          "maxCount": 1,
          "maxSize": 104857600
        },
        {
          "id": "artifact-3",
          "label": "提交文件：2.1.5.html",
          "filename": "2.1.5.html",
          "extensions": [
            ".html"
          ],
          "minCount": 1,
          "maxCount": 1,
          "maxSize": 104857600
        }
      ]
    }
  ],
  "attachments": [
    {
      "name": "2.1.5.docx",
      "url": "assets/2.1.5/2.1.5.docx",
      "size": 14770,
      "sha256": "9c4058c77a14fad7264233a8655c34f301c282ea1db5fc19e8102ac06920379a",
      "mime": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
    },
    {
      "name": "2.1.5.ipynb",
      "url": "assets/2.1.5/2.1.5.ipynb",
      "size": 3312,
      "sha256": "84b7d3821ba314735bbf82ca72f7c2441d18396349193777e80ce37e2ced7730",
      "mime": "application/x-ipynb+json"
    },
    {
      "name": "2.1.5.md",
      "url": "assets/2.1.5/2.1.5.md",
      "size": 2150,
      "sha256": "abf64b6058fae0411672327ea8921fd05609dad796e43d06b21df1ce689e5491",
      "mime": "text/markdown"
    },
    {
      "name": "健康咨询客户数据集.csv",
      "url": "assets/2.1.5/健康咨询客户数据集.csv",
      "size": 149039,
      "sha256": "c9efeb02a7aca45f1d17e99c4fbf72d2dc475bfef32b0a86083480a95e1e99d3",
      "mime": "text/csv"
    }
  ],
  "grading": {
    "mode": "completion-and-format-only"
  },
  "review": {
    "status": "approved",
    "notice": "由公开题面通用生成，未使用答案树。",
    "conflicts": []
  },
  "contentVersion": "d1c65c59b033d228"
}
