Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert System.Double[] to Python

I have a .NET assembly created by our software group that is returning numerical data of the type System.Double[].

What is the appropriate way to convert this into a Python type (list?) so I can create a dict from it?

Ben

like image 827
BMichell Avatar asked Aug 07 '26 22:08

BMichell


1 Answers

My suggestion would be to loop through the object row by row and append to the list.

So if your System.Double[] object is called myData, create a new list called myData_list, loop through myData and append to the list row by row. Try the example below. You can then convert the list into a df and plot it however you see fit.

myData_list = []
for row in myData:
    myData_list.append(row)

or using List comprehension:

myData_list = [row for row in myData]

I use this method in my application. I am using python net to access the methods in a windows .dll file and this is how I have been able to access the data.

like image 55
Tim Avatar answered Aug 09 '26 12:08

Tim