# Ray.data.from\_numpy error

**URL:** <https://discuss.ray.io/t/ray-data-from-numpy-error/8825>\
**Category:** Ray Data\
**Created:** [December 31, 2022, 10:12am UTC](https://discuss.ray.io/t/ray-data-from-numpy-error/8825 "2022-12-31T10:12:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![more](https://avatars.discourse-cdn.com/v4/letter/m/2bfe46/32.png) [@more](https://discuss.ray.io/u/more)\
**Post date:** [December 31, 2022, 10:12am UTC](https://discuss.ray.io/t/ray-data-from-numpy-error/8825/1 "2022-12-31T10:12:40Z")

</div>

**How severe does this issue affect your experience of using Ray?**

- High: It blocks me to complete my task.

**This is my sample code:**

```auto
import numpy as np
import ray

u = np.array([
    ['NG', 'YU', 'M', '1993-09-01', 'US. 100', 'Queen', 'D.C', 'True'],
    ['NG', 'YU', 'M', '1993-09-01', 'US. 100', 'Queen', 'D.C', 'True'],
    ['NG', 'YU', 'M', '1993-09-01', 'US. 100', 'Queen', 'D.C', 'True'],
])

ds = ray.data.from_numpy(u)

```

**Aften I run this python file, I got three error, below is one of them:**

 ![QQ截图20221231180728](https://us1.discourse-cdn.com/flex020/uploads/ray/original/2X/0/002f0947efa4ad4e55960b69c45a2a03587ee29d.png)

**The error is :**

> ValueError: Type’s expected number of buffers (3) did not match the passed number (2).

**I don’t know why about this, I’m a newbie rookie, can anyone help me with how to solve this problem, I’ve read the ray documentation but still don’t know how to solve it, thank you all in advance.**

---

<div class="post-metadata">

**Author:** ![Clark\_Zinzow](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ray.io/clark_zinzow/32/445_2.png) [@Clark\_Zinzow](https://discuss.ray.io/u/Clark_Zinzow)\
**Post date:** [January 3, 2023, 7:11pm UTC](https://discuss.ray.io/t/ray-data-from-numpy-error/8825/2 "2023-01-03T19:11:59Z")

</div>

Hi @more, thanks for posting this!

Unfortunately, representing n-dimensional arrays of strings in a Ray Dataset is not yet supported. We use an Arrow and Pandas extension type for representing tensor columns, and we haven’t added support for the string datatype yet: [[Datasets] Support string tensor columns. · Issue #28410 · ray-project/ray · GitHub](https://github.com/ray-project/ray/issues/28410)

However, it looks like your data might be a 2D table; we do support scalar string columns in tabular datasets, which are represented using Pandas DataFrames and/or Arrow Tables under-the-hood. Would this work for your use case?

```python
import pandas as pd
import ray

u = pd.DataFrame({
    "a": ["NG", "NG", "NG"],
    "b": ["YU", "YU", "YU"],
    "c": ["M", "M", "M"],
    "date": ["1993-09-01", "1993-09-01", "1993-09-01"],
    "e": ["US.100", "US.100", "US.100"],
    "f": ["Queen", "Queen", "Queen"],
    "g": ["D.C", "D.C", "D.C"],
    "h": ["True", "True", "True"],
})

ds = ray.data.from_pandas(u)

```

---

<div class="post-metadata">

**Author:** ![more](https://avatars.discourse-cdn.com/v4/letter/m/2bfe46/32.png) [@more](https://discuss.ray.io/u/more)\
**Post date:** [January 3, 2023, 9:18pm UTC](https://discuss.ray.io/t/ray-data-from-numpy-error/8825/3 "2023-01-03T21:18:22Z")

</div>

**Thank you for your professional response, finally answering this question that has been bothering me for a long time, a very viable solution to my needs, again, thank you.**
