# TypeError: ufunc 'subtract' 没有匹配类型 (dtype('<U32'), dtype('<U32')) -> None 的循环

- **ID:** `python/numpy-ufunc-typeerror-nonetype`
- **领域:** python
- **类别:** type_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

对 Unicode/字符串 dtype（如 '<U32'）而非数值 dtype 的 NumPy 数组执行算术运算。通常由 np.array() 从混合输入推断出字符串，或 pandas 的 object 列引起。

## 版本兼容性

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

## 解决方案

1. **** (95% 成功率)
   ```
   arr = arr.astype(np.float64); result = arr1 - arr2
   ```
2. **** (90% 成功率)
   ```
   Use pd.to_numeric(series, errors='coerce') before converting to NumPy
   ```

## 无效尝试

- **** — float() on a string array element raises ValueError before ufunc is reached (85% 失败率)
- **** — Keeps dtype as string, subtract is still undefined (90% 失败率)
