修复README,增加说明

This commit is contained in:
2026-02-27 15:43:30 +08:00
parent 641124a7cd
commit 0c0a295f09
2 changed files with 67 additions and 29 deletions

View File

@@ -150,13 +150,18 @@ class AdvancedDataCleaner:
print(f"完成!报告已生成至 {self.report_file}")
if __name__ == "__main__":
# 使用相对路径:../data/ 表示上一级目录下的 data 文件夹
input_path = '../data/raw_data_sample.json'
output_path = '../data/cleaned_data_final.json'
report_path = '../report/detailed_cleaning_report.json'
import os
# 基于脚本位置计算项目根目录,保证无论从哪里运行都能正确找到文件
script_dir = os.path.dirname(os.path.abspath(__file__))
project_root = os.path.dirname(script_dir)
input_path = os.path.join(project_root, 'data', 'raw_data_sample.json')
output_path = os.path.join(project_root, 'data', 'cleaned_data_final.json')
report_path = os.path.join(project_root, 'report', 'detailed_cleaning_report.json')
# 确保 report 目录存在
os.makedirs(os.path.dirname(report_path), exist_ok=True)
# 增加一个检查,防止路径错误
import os
if not os.path.exists(input_path):
print(f"错误:找不到文件 {input_path}")
print(f"当前工作目录是:{os.getcwd()}")