# LeRobot merge_datasets合并嵌套数组报错PandasArrayExtension。

> 原文链接：https://robotics.hellobike.com/pitfalls/2026-11-21-lerobot-2445
> 频道：pitfalls | 更新日期：2026-11-21 | 标签：auto, github-issue, lerobot
> 核心摘要：LeRobot处理N维数组特征时因HF Datasets与Pandas元数据定义冲突报错，修改源码将_metadata改为元组可绕过。

# LeRobot merge_datasets合并嵌套数组报错PandasArrayExtension。

::: v-pre
> 本文由 AI 根据公开内容整理，可能有误，请以原文为准：[PyArrow Extension Dtype Error in `merge_datasets()`](https://github.com/huggingface/lerobot/issues/2445)（GitHub huggingface/lerobot #2445）

**状态**：有绕过办法

## 问题

在LeRobot 0.4.0至0.6.1版本中，调用`merge_datasets()`、`convert_dataset_v21_to_v30.py`或`lerobot-edit-dataset`处理含嵌套数组（如`(4,3)` float32）的Parquet文件时，触发`AttributeError: 'PandasArrayExtensionDtype' object has no attribute 'v'`。

## 环境

LeRobot 0.4.0-0.6.1及main分支，Python 3.12，Pandas 2.3.3，HF Datasets 5.2.0，Linux系统。

## 解决办法

1. 定位Hugging Face Datasets库源码中的`PandasArrayExtensionDtype`类定义（通常位于`datasets/features/features.py`）。
2. 将该类中的`_metadata`属性赋值从字符串形式（如`_metadata = "value_type"`）修改为元组形式`_metadata = ("value_type",)`。
3. 保存修改后重新运行`merge_datasets()`、数据集版本转换或删除Episode等操作即可正常执行。
4. 注意此方法为临时绕过方案，需关注上游HF Datasets库的正式修复以避免后续升级冲突。

讨论原作者：@yaxiongzhao-genesis 等，版权归原作者所有。
:::

## 原始参考来源 (Sources)

- [GitHub huggingface/lerobot #2445：PyArrow Extension Dtype Error in `merge_datasets()`](https://github.com/huggingface/lerobot/issues/2445)