Send Pandas dataframe (or dictionary) from one component to another using GH_CPython Component

Hi there!

I am running Pandas to read an .xlsx file into GH_CPython component. As this process is quite slow, I want to do it once and then send the imported Dataframe to other GH_CPython components. However, everytime I connect the output with the input, Grasshopper crashes.

I have tried ‘hiding’ the Dataframe in a Python Class. The program doesn’t crash, but it doesn’t see the Dataframe either.

Is there any way I can send a Dataframe to other components?

Thanks a lot!

Hi, Does this help?

Hi Graham, thanks for the help. When I tried wrapping it, it gave the same error message as when ‘hiding’ the dataframe in a class:

AttributeError: ‘str’ object has no attribute ‘data’

So is it interpreting the data as a string…? Can you set the data type in the output / input?
Or how about pickling and unpickling it?
or json:
Bearing in mind the security implications of pickle you may want to be careful about write access to the file / folder:


Why not make use of Rhino3dm module for CPython (it is available through PIP)?
Read the file (model) with Rhino3dm then pass that to whatever.