# pandas.errors.DtypeWarning：列 (2,5) 具有混合类型。请在导入时指定 dtype 选项或设置 low_memory=False。

- **ID:** `python/pandas-dtype-warning-mixed`
- **领域:** python
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

CSV 列包含混合数据类型；pandas 分块推断 dtype 时产生不一致。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   pd.read_csv(path, dtype={'col2': str, 'col5': str})
   ```
2. **** (85% 成功率)
   ```
   pd.read_csv(path, converters={'col2': lambda x: x.strip()})
   ```

## 无效尝试

- **** — Silences warning but keeps object dtype; downstream ops still break (70% 失败率)
- **** — Values may be parsed as strings, breaking numeric ops (75% 失败率)
