方法与工具 · 数据清洗

采集数据清洗实战:去重、缺失值、字段类型与质量检查

· 马哥数据采集

系统梳理采集数据常见问题,介绍原始数据备份、去重键、缺失值处理、类型统一和质量报告。

一、永远保留原始数据

将首次导出文件设为只读备份,清洗操作在副本上进行。记录输入文件名、导出时间、数据来源和处理脚本版本,避免清洗后无法回溯。

二、先定义唯一键再去重

优先使用平台提供的稳定 ID。若没有稳定 ID,再根据来源链接、时间和必要字段设计组合键。不要仅凭文本相同就删除记录,因为不同来源可能存在内容相同但记录不同的情况。

三、区分不同缺失情况

空值可能表示字段不可用、接口未返回、内容确实为空或解析失败。建议用状态字段区分原因,不要把所有缺失值都填成 0 或“未知”。

四、统一字段类型

五、输出质量报告

至少统计总行数、重复数、关键字段缺失率、异常值数量和处理后行数。对关键字段抽样回查来源,确认清洗没有破坏语义。

清洗规则会影响分析结果。每一条自动删除或转换规则都应有理由,并尽量保留处理前后的对照。
相关工具

可进一步查看对应产品的功能介绍、适用范围和当前版本说明。

查看相关产品 →
← 返回技术博客
Tools & Methods · Data Cleaning

Data Cleaning in Practice: Duplicates, Missing Values, Types, and Quality Checks

· Mage Data Tools

A systematic guide to common collection-data issues, including raw backups, deduplication keys, missing-value handling, type normalization, and quality reports.

1. Always Preserve the Raw Data

Keep the first exported file as a read-only backup and perform cleaning on a copy. Record the input filename, export time, data source, and processing-script version so the process can be traced later.

2. Define a Unique Key Before Deduplication

Prefer a stable ID provided by the platform. If none exists, design a composite key from the source URL, timestamp, and necessary fields. Do not delete records based only on matching text: different sources may contain identical content but represent different records.

3. Distinguish Different Types of Missing Data

A blank value may mean a field is unavailable, the API did not return it, the content is genuinely empty, or parsing failed. Use status fields to distinguish these cases rather than filling every missing value with zero or “unknown.”

4. Normalize Field Types

5. Produce a Quality Report

At minimum, report total rows, duplicates, missing rates for key fields, abnormal-value counts, and the number of rows remaining after processing. Sample important fields against their sources to ensure cleaning has not changed their meaning.

Cleaning rules affect analysis results. Every automatic deletion or transformation should have a reason, and before-and-after values should be retained whenever possible.
Related Tool

See the related product page for features, scope, and current version information.

View related product →
← Back to the technical blog