# PyDataSet columns

**URL:** <https://forum.inductiveautomation.com/t/pydataset-columns/8445>\
**Category:** General Discussion\
**Created:** [May 14, 2014, 7:25pm UTC](https://forum.inductiveautomation.com/t/pydataset-columns/8445 "2014-05-14T19:25:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JGJohnson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jgjohnson/32/29582_2.png) [@JGJohnson](https://forum.inductiveautomation.com/u/JGJohnson)\
**Post date:** [May 14, 2014, 7:25pm UTC](https://forum.inductiveautomation.com/t/pydataset-columns/8445/1 "2014-05-14T19:25:13Z")

</div>

To get the column headers from a pydataset I know I can do this:

```auto
ds = system.dataset.toDataSet(myPyDataSet)
column_headers = ds.getColumnNames()
```

but is there some method of getting the headers directly from a pydataset without doing the conversion?

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [May 14, 2014, 7:36pm UTC](https://forum.inductiveautomation.com/t/pydataset-columns/8445/2 "2014-05-14T19:36:47Z")

</div>

Hi JGJohnson,

```auto
column_headers = myPyDataSet.getUnderlyingDataset().getColumnNames()
```

---

<div class="post-metadata">

**Author:** ![JGJohnson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jgjohnson/32/29582_2.png) [@JGJohnson](https://forum.inductiveautomation.com/u/JGJohnson)\
**Post date:** [May 14, 2014, 8:12pm UTC](https://forum.inductiveautomation.com/t/pydataset-columns/8445/3 "2014-05-14T20:12:28Z")

</div>

Awesome! Thanks nick.

BTW getColumnNames() returns a list of type java.util.Collections.UnmodifiableRandomAccessList and it has no .index() method, so be sure to use .indexOf() instead.

There are probably other differences as well.

[http://www.docjar.org/docs/api/java/util/Collections.UnmodifiableRandomAccessList.html](http://www.docjar.org/docs/api/java/util/Collections.UnmodifiableRandomAccessList.html)

---

<div class="post-metadata">

**Author:** ![nmudge](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nmudge/32/3394_2.png) [@nmudge](https://forum.inductiveautomation.com/u/nmudge)\
**Post date:** [May 16, 2014, 6:24pm UTC](https://forum.inductiveautomation.com/t/pydataset-columns/8445/4 "2014-05-16T18:24:00Z")

</div>

If you want the column names as a regular python list and not a java.util.Collections.UnmodifiableRandomAccessList then covert it using the “list” function like so:

```auto
column_headers = list(myPyDataSet.getUnderlyingDataset().getColumnNames())
```
