feat(dc/tool-c): Add missing value imputation feature with 6 methods and MICE

Major features:
1. Missing value imputation (6 simple methods + MICE):
   - Mean/Median/Mode/Constant imputation
   - Forward fill (ffill) and Backward fill (bfill) for time series
   - MICE multivariate imputation (in progress, shape issue to fix)

2. Auto precision detection:
   - Automatically match decimal places of original data
   - Prevent false precision (e.g. 13.57 instead of 13.566716417910449)

3. Categorical variable detection:
   - Auto-detect and skip categorical columns in MICE
   - Show warnings for unsuitable columns
   - Suggest mode imputation for categorical data

4. UI improvements:
   - Rename button: "Delete Missing" to "Missing Value Handling"
   - Remove standalone "Dedup" and "MICE" buttons
   - 3-tab dialog: Delete / Fill / Advanced Fill
   - Display column statistics and recommended methods
   - Extended warning messages (8 seconds for skipped columns)

5. Bug fixes:
   - Fix sessionService.updateSessionData -> saveProcessedData
   - Fix OperationResult interface (add message and stats)
   - Fix Toolbar button labels and removal

Modified files:
Python: operations/fillna.py (new, 556 lines), main.py (3 new endpoints)
Backend: QuickActionService.ts, QuickActionController.ts, routes/index.ts
Frontend: MissingValueDialog.tsx (new, 437 lines), Toolbar.tsx, index.tsx
Tests: test_fillna_operations.py (774 lines), test scripts and docs
Docs: 5 documentation files updated

Known issues:
- MICE imputation has DataFrame shape mismatch issue (under debugging)
- Workaround: Use 6 simple imputation methods first

Status: Development complete, MICE debugging in progress
Lines added: ~2000 lines across 3 tiers
This commit is contained in:
2025-12-10 13:06:00 +08:00
parent f4f1d09837
commit 74cf346453
102 changed files with 3806 additions and 181 deletions

View File

@@ -1,10 +1,10 @@
# 工具C MVP开发 - To-do List
> **文档版本**v1.3
> **文档版本**v1.4
> **创建日期**2025-12-06
> **最后更新**2025-12-08
> **最后更新**2025-12-10
> **预计工期**3周15个工作日
> **实际进度**Week 1-2完成功能按钮Phase 1-2完成✅
> **实际进度**Week 1-2完成功能按钮Phase 1-2完成✅ + NA处理优化✅ + Pivot列顺序优化✅
> **参考文档**[工具C_MVP开发计划_V1.0.md](./工具C_MVP开发计划_V1.0.md), [工具C_功能按钮开发计划_V1.0.md](./工具C_功能按钮开发计划_V1.0.md)
---
@@ -22,18 +22,18 @@
---
## 🎉 最新进展2025-12-08
## 🎉 最新进展2025-12-10
### ✅ 功能按钮开发Phase 1-2
**7个核心功能已完成**
1. ✅ 高级筛选器多条件AND/OR
2. ✅ 数值映射(重编码)
3. ✅ 生成分类变量(等宽/等频/自定义切点)
4. ✅ 条件生成列IF-THEN-ELSE复杂逻辑
1. ✅ 高级筛选器多条件AND/OR + 为空/不为空条件
2. ✅ 数值映射(重编码 + NA处理选项保持/映射/删除
3. ✅ 生成分类变量(等宽/等频/自定义切点 + NA处理选项
4. ✅ 条件生成列IF-THEN-ELSE + 为空/不为空条件
5. ✅ 删除缺失值(按行/列,阈值控制)
6. ✅ 计算列(公式构建器10+数学函数
7. ✅ Pivot转换长表→宽表
6. ✅ 计算列(方案B安全列名映射支持特殊字符列名
7. ✅ Pivot转换长表→宽表 + 保留未选列 + 原始列顺序
**技术架构**
- ✅ 预写Python函数架构稳定、安全、高性能
@@ -42,8 +42,43 @@
- ✅ 完整的前后端集成
- ✅ 友好的UI交互Dialog + 实时验证)
**待开发**
- ⏳ 多重插补MICE- 最后一个功能
### ✅ NA处理优化2025-12-09~10
**4个功能支持空值处理**
1. ✅ 数值映射 - NA处理选项保持NA/映射为指定值/删除行)
2. ✅ 高级筛选 - 为空/不为空条件(原有支持)
3. ✅ 生成分类变量 - NA处理选项保持为空/标记为"缺失"/分配到指定组)
4. ✅ 条件生成列 - 为空/不为空运算符
### ✅ Pivot列顺序优化2025-12-10
- ✅ 保留未选择的列(可选功能)
- ✅ 未选列聚合方式(取第一个值/取众数/取均值)
- ✅ 保持原始列顺序(转换后列按原文件顺序排列)
- ✅ 透视列值按首次出现顺序排列
### ✅ UX优化2025-12-09
- ✅ 列头tooltip鼠标悬停显示完整列名
- ✅ 50行预览提示可关闭
- ✅ 页面滚动条优化(内部滚动,无整页滚动)
### ✅ 计算列方案B实施2025-12-09
- ✅ 前端安全列名映射col_0, col_1...
- ✅ 后端columnMapping存储和传递
- ✅ Python端使用columnMapping计算支持特殊字符列名
**新增功能2025-12-10下午**
- ✅ 缺失值填补6种方法均值/中位数/众数/固定值/前向填充/后向填充)- 已开发
- 🚧 MICE多重插补 - 已集成DataFrame shape问题待调试
- ✅ 自动精度检测 - 填补值自动匹配原始数据小数位数
- ✅ 分类列识别 - MICE自动跳过分类列并提示
- ✅ 功能按钮优化 - 移除"去重"和"多重插补"独立按钮,合并到"缺失值处理"
- ✅ 自动化测试脚本 - 18个测试用例test_fillna_operations.py
**待调试**
- ⏳ MICE多重插补的DataFrame重建逻辑Shape mismatch问题
---