# system.dataset.toDataSet() - row 0 does not contain correct number of columns

**URL:** <https://forum.inductiveautomation.com/t/system-dataset-todataset-row-0-does-not-contain-correct-number-of-columns/56853>\
**Category:** Ignition\
**Created:** [March 4, 2022, 4:54pm UTC](https://forum.inductiveautomation.com/t/system-dataset-todataset-row-0-does-not-contain-correct-number-of-columns/56853 "2022-03-04T16:54:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JoeF](https://avatars.discourse-cdn.com/v4/letter/j/4da419/32.png) [@JoeF](https://forum.inductiveautomation.com/u/JoeF)\
**Post date:** [March 4, 2022, 4:54pm UTC](https://forum.inductiveautomation.com/t/system-dataset-todataset-row-0-does-not-contain-correct-number-of-columns/56853/1 "2022-03-04T16:54:51Z")

</div>

I am reading datasets from tags, adding some new columns, then converting back to one dataset. I have confirmed from handful of other topics that the data in the rows are valid and that their lengths are equal. Since everything appears to be valid, I'm at a loss as to why the conversion is not happening.

```python
print new_data[0]
print len(new_data[0])
print len(headers)
final = system.dataset.toDataSet(new_data, headers)

```

**In my example:**  
Printing row 0 returns a list of length 14  
new\_data is a list of lists  
len(new\_data[0]) returns 14  
len(headers) returns 14

**Other topics I've visited:**

> [@system.dataset.toDataSet Wrong Number of Columns](https://forum.inductiveautomation.com/t/system-dataset-todataset-wrong-number-of-columns/23510):
>
> I’m stumped on why this won’t work. All I want is a dataset with one column and one row, but I get Row 0 doesn't have the same number of columns as header list header = ['column'] rows = ['MANHATTAN'] system.dataset.toDataSet(header,rows)

> [@Row 0 doesn't have the same number of columns as header list error](https://forum.inductiveautomation.com/t/row-0-doesnt-have-the-same-number-of-columns-as-header-list-error/43527/):
>
> when i run the above script i am getting this error Row 0 doesn’t have the same number of columns as header list. can any one help me out on this

---

<div class="post-metadata">

**Author:** ![jpark](https://avatars.discourse-cdn.com/v4/letter/j/a88e57/32.png) [@jpark](https://forum.inductiveautomation.com/u/jpark)\
**Post date:** [March 4, 2022, 5:48pm UTC](https://forum.inductiveautomation.com/t/system-dataset-todataset-row-0-does-not-contain-correct-number-of-columns/56853/2 "2022-03-04T17:48:12Z")

</div>

header should go first.

`final = system.dataset.toDataSet(headers,new_data)`

---

<div class="post-metadata">

**Author:** ![JoeF](https://avatars.discourse-cdn.com/v4/letter/j/4da419/32.png) [@JoeF](https://forum.inductiveautomation.com/u/JoeF)\
**Post date:** [March 4, 2022, 5:52pm UTC](https://forum.inductiveautomation.com/t/system-dataset-todataset-row-0-does-not-contain-correct-number-of-columns/56853/3 "2022-03-04T17:52:34Z")

</div>

Unreal, thank you so much for getting me over the tough Friday moment.
