# Invalid argument \`columns\[1\].name\` passed into DataTable

**URL:** <https://community.plotly.com/t/invalid-argument-columns-1-name-passed-into-datatable/25478>\
**Category:** Dash Python\
**Created:** [July 5, 2019, 5:16am UTC](https://community.plotly.com/t/invalid-argument-columns-1-name-passed-into-datatable/25478 "2019-07-05T05:16:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![aidlml](https://avatars.discourse-cdn.com/v4/letter/a/c89c15/32.png) [@aidlml](https://community.plotly.com/u/aidlml)\
**Post date:** [July 5, 2019, 5:16am UTC](https://community.plotly.com/t/invalid-argument-columns-1-name-passed-into-datatable/25478/1 "2019-07-05T05:16:43Z")

</div>

dash\_table.DataTable(  
style\_data={‘whiteSpace’: ‘normal’},  
css=[{  
‘selector’: ‘.dash-cell div.dash-cell-value’,  
‘rule’: ‘display: inline; white-space: inherit; overflow: inherit; text-overflow: inherit;’  
}],  
data=bed.to\_dict(‘records’),  
columns=[{‘id’: str(c), ‘name’: c} for c in bed.columns],  
# fixed\_rows={ ‘headers’: True, ‘data’: 0 },  
style\_cell={‘width’: ‘150px’,‘textAlign’: ‘left’},  
style\_cell\_conditional=[  
{‘if’: {‘column\_id’: ‘Region’},‘textAlign’: ‘left’}  
],  
style\_data\_conditional=[  
{‘if’: {‘row\_index’: ‘odd’},‘backgroundColor’: ‘rgb(248, 248, 248)’}  
],  
style\_header={  
‘backgroundColor’: ‘rgb(0,0,0)’, #‘rgb(230, 230, 230)’,  
‘fontWeight’: ‘bold’,‘color’: ‘yellow’,‘fontSize’: 20  
},  
style\_table={  
‘maxHeight’: ‘100’,  
# ‘overflowY’: ‘scroll’  
‘border’: ‘thin lightgrey solid’  
},  
),

---

<div class="post-metadata">

**Author:** ![nilsleh](https://avatars.discourse-cdn.com/v4/letter/n/eb8c5e/32.png) [@nilsleh](https://community.plotly.com/u/nilsleh)\
**Post date:** [May 23, 2020, 10:57am UTC](https://community.plotly.com/t/invalid-argument-columns-1-name-passed-into-datatable/25478/2 "2020-05-23T10:57:24Z")

</div>

I had just ran into the same error, and for me the issue was that the column names were integers and not strings. so then the dictionary created in

```auto
columns=[{'name': i, 'id': i,} for i in df.columns]

```

gets an error because it will read {‘name’: 2013, ‘id’: ‘2013’} and not {‘name’: ‘2013’, ‘id’: ‘2013’}.

---

<div class="post-metadata">

**Author:** ![kozoria](https://avatars.discourse-cdn.com/v4/letter/k/3d9bf3/32.png) [@kozoria](https://community.plotly.com/u/kozoria)\
**Post date:** [July 1, 2020, 1:24am UTC](https://community.plotly.com/t/invalid-argument-columns-1-name-passed-into-datatable/25478/3 "2020-07-01T01:24:49Z")

</div>

So how do you turn that key ‘name’'s value to a string?

---

<div class="post-metadata">

**Author:** ![chriddyp](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/chriddyp/32/16855_2.png) [@chriddyp](https://community.plotly.com/u/chriddyp)\
**Post date:** [July 1, 2020, 3:43am UTC](https://community.plotly.com/t/invalid-argument-columns-1-name-passed-into-datatable/25478/4 "2020-07-01T03:43:28Z")

</div>

> [@nilsleh](#):
>
> `columns=[{'name': i, 'id': i,} for i in df.columns]`

> [@kozoria](#):
>
> So how do you turn that key ‘name’'s value to a string?

With something like this:

```auto
columns=[{'name': str(i), 'id': str(i)} for i in df.columns]

```
