01-09-2018 04:06 PM
How do you unpack a pandas dataframe?
From unpack module I wired from "Python Object References Out" (PORO) to "Variant to Data". Then "Variant to Data" to a 2D array. The (PORO) polymorph is set to variant.
As this wasn't working, I then tried just having my python function output a list of lists instead of a dataframe. I.e. return [[1.0,2,3,4],[2.0,7,8,9]]. Still no luck
But if I just return a double single output, change the polymorph and wire value to double indicator, the program works fine. I.e. return 2
I still cannot unpack correctly using enthought python development kit for labview. I furthermore cannot find any examples.
Example labview vi included. Here is the basic python code:
def df(num):
some_list = []
another_list = []
for i in range(num):
some_list.append(i)
another_list.append(i)
#return [some_list, another_list] <-- I cannot unpack this correctly
return some_list #no problem unpacking this in labview
01-10-2018 04:30 PM
If a community member doesn't know, you could try reaching out to Enthought product support as well.
01-11-2018 09:14 AM
scr,
Dataframes and lists (and lists of lists) are data types specific to Python. LabVIEW does not inherently have any of these data types. The closest thing in LabVIEW to this would be arrays, and arrays of arrays.
According to Enthought's Getting Started Guide, NumPy arrays are the only type of array supported by the Python/LabVIEW bridge. To achieve your 'list of lists' with the Python Integration Toolkit, we'll want to return a multidimensional array of arrays in Python (save the attached text file as a Python file), and we can unpack the data as a variant and convert that 'value' output to a 2D (or more) array.
To reiterate, this is Enthought's product and you should contact them for help as titen said, this just sparked my interest.
Hope this helps, big guy.
BrandonN