# Best way to pivot a dataset

**URL:** <https://forum.inductiveautomation.com/t/best-way-to-pivot-a-dataset/33568>\
**Category:** Ignition\
**Tags:** ignition80, scripting\
**Created:** [March 31, 2020, 11:41pm UTC](https://forum.inductiveautomation.com/t/best-way-to-pivot-a-dataset/33568 "2020-03-31T23:41:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dansadowski](https://avatars.discourse-cdn.com/v4/letter/d/d6d6ee/32.png) [@dansadowski](https://forum.inductiveautomation.com/u/dansadowski)\
**Post date:** [March 31, 2020, 11:41pm UTC](https://forum.inductiveautomation.com/t/best-way-to-pivot-a-dataset/33568/1 "2020-03-31T23:41:28Z")

</div>

I’ve got a tall dataset that has a large number of rows that represent the shift schedule for all the machines at my plant… I’d like to pivot it so that I get something like the following:

 ![snip](https://us1.discourse-cdn.com/inductiveautomation/original/2X/c/cea778d84745d03465aad1b5f40aef903aa9eff7.png)

Normally, I would just use numpy and pandas to handle the pivot… but since CPython libraries aren’t allowed, I’m kind of stuck with either having to do something funky (like write the dataset to a SQL table and use the SQL Pivot operator) or having to code the pivot myself.

Anyone have any suggestions? Is there an easy way to access R from inside of Ignition?

Thanks in advance,  
Dan

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 1, 2020, 12:47am UTC](https://forum.inductiveautomation.com/t/best-way-to-pivot-a-dataset/33568/2 "2020-04-01T00:47:36Z")

</div>

You can do this with the [view()](https://www.automation-pros.com/simaids/doc/expression.view.html) expression function from my (free) [Simulation Aids](https://inductiveautomation.com/moduleshowcase/module/automation-professionals-llc-simulation-aids) module.

As noted in the linked doc, you can even turn on a debug logger to have it show you the jython it writes for your specific case.

---

<div class="post-metadata">

**Author:** ![dansadowski](https://avatars.discourse-cdn.com/v4/letter/d/d6d6ee/32.png) [@dansadowski](https://forum.inductiveautomation.com/u/dansadowski)\
**Post date:** [April 1, 2020, 3:52pm UTC](https://forum.inductiveautomation.com/t/best-way-to-pivot-a-dataset/33568/3 "2020-04-01T15:52:04Z")

</div>

Very cool. Thank you for the quick response. I’ll see if this is going to work for my usecase.

Dan
