# InvalidIndexError: 重新索引仅对唯一值的 Index 对象有效

- **ID:** `python/pandas-invalidindex-on-reset`
- **领域:** python
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

reindex、join 或按 axis=0 的 merge 操作遇到重复索引标签。常见于 concat 多个各带索引的 DataFrame 后。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   df = df.reset_index(drop=True) before reindex/merge
   ```
2. **** (90% 成功率)
   ```
   df = df[~df.index.duplicated(keep='first')]
   ```

## 无效尝试

- **** — Sorting doesn't remove duplicates (85% 失败率)
- **** — Still requires unique index (90% 失败率)
