# Elasticsearch using eland for python fails to write when having nan in the dataset

**URL:** <https://discuss.elastic.co/t/elasticsearch-using-eland-for-python-fails-to-write-when-having-nan-in-the-dataset/292958>\
**Category:** Elasticsearch\
**Created:** [December 27, 2021, 8:33am UTC](https://discuss.elastic.co/t/elasticsearch-using-eland-for-python-fails-to-write-when-having-nan-in-the-dataset/292958 "2021-12-27T08:33:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jaykant\_Prajapati](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaykant_prajapati/32/96232_2.png) [@Jaykant\_Prajapati](https://discuss.elastic.co/u/Jaykant_Prajapati)\
**Post date:** [December 27, 2021, 8:33am UTC](https://discuss.elastic.co/t/elasticsearch-using-eland-for-python-fails-to-write-when-having-nan-in-the-dataset/292958/1 "2021-12-27T08:33:41Z")

</div>

0

I am creating pandas dataset with such that 'num\_specimen\_seen' is having one value null. I am defining nan using the math.nan. The dataset df is saved in haze.csv file.

```auto
df = pd.DataFrame({'num_legs': [2, 4, 8, 0],
                   'num_wings': [2, 0, 0, 0],
                   'num_specimen_seen': [10, 2,math.nan, 8]},
                  )
df.to_csv('haze.csv')
Unnamed: 0 num_legs num_wings num_specimen_seen
0 0 2 2 10.0
1 1 4 0 2.0
2 2 8 0 NaN
3 3 0 0 8.0

```

I am uploading this haze.csv to Elasticsearch using eland as follows:

```auto
ed.csv_to_eland(
... "haze.csv",
... es_client='http://localhost:9200',
... es_dest_index='haze',
... es_refresh=True,
... index_col=0
... )

```

But it is giving an error as follows:

BulkIndexError: 1 document(s) failed to index.

Can any one help me how to map nan into Elasticsearch?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 24, 2022, 8:34am UTC](https://discuss.elastic.co/t/elasticsearch-using-eland-for-python-fails-to-write-when-having-nan-in-the-dataset/292958/2 "2022-01-24T08:34:22Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
