# Saving individual column to tags

**URL:** <https://forum.inductiveautomation.com/t/saving-individual-column-to-tags/20110>\
**Category:** Ignition\
**Tags:** ignition79, scripting\
**Created:** [October 11, 2018, 10:26pm UTC](https://forum.inductiveautomation.com/t/saving-individual-column-to-tags/20110 "2018-10-11T22:26:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![agweb.salinas](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@agweb.salinas](https://forum.inductiveautomation.com/u/agweb.salinas)\
**Post date:** [October 11, 2018, 10:26pm UTC](https://forum.inductiveautomation.com/t/saving-individual-column-to-tags/20110/1 "2018-10-11T22:26:26Z")

</div>

So I have a data table with four columns and I’m trying to take 2 of those columns (column 0 and 3) and save them to a data set tag

I’m having a little trouble working around a coding error. in the second to last line.

```auto
data = event.source.parent.getComponent("Table").data
pds = system.dataset.toPyDataSet(data)

Date_data = [col[0] for row in pds]
GDD_data = [row[3] for row in pds]	

headers = ["Date", "GDD"]
New_data = [Date_data, GDD_data]

tagdata = system.dataset.toDataSet(headers, New_data)
system.tag.write("Growing Days", tagdata)

```

error: Row 0 doesn’t have the same number of columns as header list.

---

<div class="post-metadata">

**Author:** ![mrogers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mrogers/32/4110_2.png) [@mrogers](https://forum.inductiveautomation.com/u/mrogers)\
**Post date:** [October 11, 2018, 10:31pm UTC](https://forum.inductiveautomation.com/t/saving-individual-column-to-tags/20110/2 "2018-10-11T22:31:34Z")

</div>

Try this:

```auto
data = event.source.parent.getComponent("Table").data
pds = system.dataset.toPyDataSet(data)

#Date_data = [col[0] for row in pds] #Removed, see below
#GDD_data = [row[3] for row in pds] #Removed, see below

headers = ["Date", "GDD"]
New_data = [[col[0], row[3]] for row in pds]

tagdata = system.dataset.toDataSet(headers, New_data)
system.tag.write("Growing Days", tagdata)

```

toDataSet() takes a list of lists, so New\_data has to assign it like this.

---

<div class="post-metadata">

**Author:** ![agweb.salinas](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@agweb.salinas](https://forum.inductiveautomation.com/u/agweb.salinas)\
**Post date:** [October 11, 2018, 10:36pm UTC](https://forum.inductiveautomation.com/t/saving-individual-column-to-tags/20110/3 "2018-10-11T22:36:35Z")

</div>

Super helpful. Much Thanks! 🙏
