Skip to content Skip to sidebar Skip to footer

Python Ctypes: How To Pass Row Outputs From A C Function Into A Pandas Dataframe?

My question is how to parse tab-delimited output from a C function into a pandas DataFrame via ctypes: I am writing a Python wrapper in Python3.x around a C library using ctypes. T

Solution 1:

I was going to make a comment but stackoverflow block me from that.

1- The pandas object pass to c functions like PyObject *, so lib.return_query.argtypes = (c_types.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p)

2- If you are returning a tab-delimited rows that sounds more like ctypes.c_char_p, not lib.return_query.restype = ctypes.c_char. And your function int return_query, should be char * return_query

These are comments and observations not a full answer....

Post a Comment for "Python Ctypes: How To Pass Row Outputs From A C Function Into A Pandas Dataframe?"