# Dataset preview: pyarrow.lib.ArrowTypeError: ("Expected bytes, got a 'float' object"

**URL:** <https://discuss.huggingface.co/t/dataset-preview-pyarrow-lib-arrowtypeerror-expected-bytes-got-a-float-object/169874>\
**Category:** 🤗Datasets\
**Created:** [November 3, 2025, 3:52pm UTC](https://discuss.huggingface.co/t/dataset-preview-pyarrow-lib-arrowtypeerror-expected-bytes-got-a-float-object/169874 "2025-11-03T15:52:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![stefanches](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/stefanches/32/51073_2.png) [@stefanches](https://discuss.huggingface.co/u/stefanches)\
**Post date:** [November 3, 2025, 3:52pm UTC](https://discuss.huggingface.co/t/dataset-preview-pyarrow-lib-arrowtypeerror-expected-bytes-got-a-float-object/169874/1 "2025-11-03T15:52:41Z")

</div>

Hello there,

uploading a dataset with a wide table annotation: [test/metadata.csv · stefanches/genomic-bioimaging at main](https://huggingface.co/datasets/stefanches/genomic-bioimaging/blob/main/test/metadata.csv)

and pyarrow apparently struggles with the metadata read-in.

I was able to solve it locally using [pyarrow.lib.ArrowTypeError: "Expected a string or bytes object, got a 'int' object" · Issue #349 · wesm/feather · GitHub](https://github.com/wesm/feather/issues/349#issuecomment-569872248) , but it seems I could not correct the code for the dataset preview on HF? Appreciate any advice, happy to provide more info.

---

<div class="post-metadata">

**Author:** ![stefanches](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/stefanches/32/51073_2.png) [@stefanches](https://discuss.huggingface.co/u/stefanches)\
**Post date:** [November 3, 2025, 3:53pm UTC](https://discuss.huggingface.co/t/dataset-preview-pyarrow-lib-arrowtypeerror-expected-bytes-got-a-float-object/169874/2 "2025-11-03T15:53:50Z")

</div>

Stacktrace from HF:

 ![image](https://us1.discourse-cdn.com/hellohellohello/original/3X/a/7/a7089a496b9d34b423b628ee26f06455b76e1101.png)

---

<div class="post-metadata">

**Author:** ![stefanches](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/stefanches/32/51073_2.png) [@stefanches](https://discuss.huggingface.co/u/stefanches)\
**Post date:** [November 3, 2025, 4:11pm UTC](https://discuss.huggingface.co/t/dataset-preview-pyarrow-lib-arrowtypeerror-expected-bytes-got-a-float-object/169874/3 "2025-11-03T16:11:39Z")

</div>

cc @lhoestq

---

<div class="post-metadata">

**Author:** ![lhoestq](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/lhoestq/32/52888_2.png) [@lhoestq](https://discuss.huggingface.co/u/lhoestq)\
**Post date:** [November 4, 2025, 10:58am UTC](https://discuss.huggingface.co/t/dataset-preview-pyarrow-lib-arrowtypeerror-expected-bytes-got-a-float-object/169874/4 "2025-11-04T10:58:40Z")

</div>

I guess the issue comes from some column containing a mix of strings and floats ?

Can you check your CSV doesn’t have mixed types ?

---

<div class="post-metadata">

**Author:** ![stefanches](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/stefanches/32/51073_2.png) [@stefanches](https://discuss.huggingface.co/u/stefanches)\
**Post date:** [November 4, 2025, 11:18am UTC](https://discuss.huggingface.co/t/dataset-preview-pyarrow-lib-arrowtypeerror-expected-bytes-got-a-float-object/169874/5 "2025-11-04T11:18:05Z")

</div>

It is indeed the problem. In the column “Cluster” I had e.g. entries like “4+5”, which I think were read as strings on par with single-cluster entries.

I could not figure out any sane way to save these mixed type columns as string columns, quoting did not help - so I dropped these columns entirely as a fast-hand solution. But of course it is not a good practice.

---

<div class="post-metadata">

**Author:** ![lhoestq](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/lhoestq/32/52888_2.png) [@lhoestq](https://discuss.huggingface.co/u/lhoestq)\
**Post date:** [November 4, 2025, 3:31pm UTC](https://discuss.huggingface.co/t/dataset-preview-pyarrow-lib-arrowtypeerror-expected-bytes-got-a-float-object/169874/6 "2025-11-04T15:31:52Z")

</div>

Ok, btw don’t hesitate to try formats that make typing easier such as JSON Lines, or even Parquet

---

<div class="post-metadata">

**Author:** ![stefanches](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/stefanches/32/51073_2.png) [@stefanches](https://discuss.huggingface.co/u/stefanches)\
**Post date:** [November 4, 2025, 4:31pm UTC](https://discuss.huggingface.co/t/dataset-preview-pyarrow-lib-arrowtypeerror-expected-bytes-got-a-float-object/169874/7 "2025-11-04T16:31:08Z")

</div>

Oh, great tip - I will try that next time!
