2

I'm calling a python function using the UiPath Python Activities Pack (Get Python Object) and it returns a DataFrame in order to use it within UiPath. Unfortunately, UiPath is not able to convert the DataFrame to a .Net DataType like a DataTable.

enter image description here

Even when I try to convert the DataFrame to any other format (String, numpy array, html etc.) it is not working although the documentation mentions explicitly that all DataTypes are supported. The Python script does its work an stores the Content of the DataFrame in an Excel file and I could, of course, just read the Excel file. I was just wondering whether there is a way to directly pass the data to UiPath instead of saving it first and reading it again.

Mikkel
  • 140
  • 1
  • 8

1 Answers1

2

Actually, I spent quite some time on this but finally figured out how to pass the pandas DataFrame to UiPath and make it available there in a dataTable. I explain how I did it in the following:

  1. Python Script:
    I let the python function that I call in the UiPath 'Invoke Paython Method' activity return the pandas dataframe as a JSON string, i.e.

    return df.to_json(orient='records')

  2. Get Python Object:
    Save the JSON string in a variable of type string

  3. Deserialize JSON:
    Choose 'System.Data.DataTable' as TypeArgument and store the result in a variable of type dataTable

enter image description here

Now the Data from the pandas dataFrame is available in a .Net dataTable in Uipath.

Mikkel
  • 140
  • 1
  • 8