# FutureWarning: 在 .fillna、.ffill、.bfill 上对 object dtype 数组进行向下转型已被弃用，未来版本将改变。

- **ID:** `python/pandas-futurewarning-downcasting`
- **领域:** python
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

pandas 2.1+ 弃用了填充 object dtype Series 时的隐式向下转型。未来版本将保留 object dtype。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   Explicitly cast: df['col'] = df['col'].astype('float64').fillna(0)
   ```
2. **** (85% 成功率)
   ```
   Use pd.set_option('future.no_silent_downcasting', True) to opt in early
   ```

## 无效尝试

- **** — Behavior will still change in future pandas (85% 失败率)
- **** — Can raise on incompatible columns (70% 失败率)
