# Dataset.map with None lists

**URL:** <https://discuss.huggingface.co/t/dataset-map-with-none-lists/15580>\
**Category:** 🤗Datasets\
**Created:** [March 10, 2022, 3:56pm UTC](https://discuss.huggingface.co/t/dataset-map-with-none-lists/15580 "2022-03-10T15:56:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![frascuchon](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/frascuchon/32/49520_2.png) [@frascuchon](https://discuss.huggingface.co/u/frascuchon)\
**Post date:** [March 10, 2022, 3:56pm UTC](https://discuss.huggingface.co/t/dataset-map-with-none-lists/15580/1 "2022-03-10T15:56:16Z")

</div>

I’m doing some transformations over a dataset with a `labels` column where some values are `None` but after the first `.map` transformation over a new field, the `None` values are converted into empty lists.

It’s a normal behaviour? How can I preserve the `None` values?

Thanks in advance!

---

<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:** [March 11, 2022, 12:16pm UTC](https://discuss.huggingface.co/t/dataset-map-with-none-lists/15580/2 "2022-03-11T12:16:06Z")

</div>

Hi ! yes this is a known bug, see [`None` replaced by `[]` after first batch in map · Issue #3676 · huggingface/datasets · GitHub](https://github.com/huggingface/datasets/issues/3676)

This can be fixed once Apache Arrow has the feature we requested here: [[ARROW-15839] [C++][Python] Allow to reconstruct a ListArray with ListArray.from\_arrays and keep the nulls - ASF JIRA](https://issues.apache.org/jira/browse/ARROW-15839)

Feel free to post a message/vote for this issue on Arrow’s JIRA to express your need, this can probably help the Arrow team to prioritize this.

In the meantime we’re looking at workarounds to fix this, I’ll let you know what we come up with

---

<div class="post-metadata">

**Author:** ![frascuchon](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/frascuchon/32/49520_2.png) [@frascuchon](https://discuss.huggingface.co/u/frascuchon)\
**Post date:** [March 11, 2022, 5:55pm UTC](https://discuss.huggingface.co/t/dataset-map-with-none-lists/15580/3 "2022-03-11T17:55:01Z")

</div>

Thanks @lhoestq for response.

I didn’t find the issue in the repo. I’ve voted the issue in pyarrow jira.

Thanks for letting me know about a workaround when ready.
