Search code examples
python.netpandaspython.netpythonnet

Pythonnet System.Object[,] to Pandas DataFrame or Numpy Array


I am using Pythonnet to call a C# function which returns a clr Object ( an n x m matrix). In python the type is System.Object[,]. How can I convert this variable to a Pandas DataFrame or something more manageable?

Thank you.


Solution

  • pd.DataFrame([[obj[j, i] for j in range(obj.GetLength(1))] for i in range(obj.GetLength(0))])