是否有适用于python熊猫的C/C ++ API?

是否有适用于python熊猫的C/C ++ API?

问题描述:

我正在使用C/C ++从旧版后端系统中提取海量数据,然后使用distutils将其移至Python.在Python中获取数据后,我将其放入pandas DataFrame对象中进行数据分析.现在,我想走得更快,想避免第二步.

I'm extracting mass data from a legacy backend system using C/C++ and move it to Python using distutils. After obtaining the data in Python, I put it into a pandas DataFrame object for data analysis. Now I want to go faster and would like to avoid the second step.

是否有用于熊猫的C/C ++ API在C/C ++中创建DataFrame,添加我的C/C ++数据并将其传递给Python?我在想类似于numpy C API的东西.

Is there a C/C++ API for pandas to create a DataFrame in C/C++, add my C/C++ data and pass it to Python? I'm thinking of something that is similar to numpy C API.

我已经想到了在C语言中创建numpy数组对象的一种解决方法,但是我大量使用时间序列数据,并且希望同时拥有TimeSeries和date_range对象.

I already thougth of creating numpy array objects in C as a workaround but i'm heavily using timeseries data and would love to have the TimeSeries and date_range objects as well.

所有熊猫类(TimeSeries,DataFrame,DatetimeIndex等)都具有纯Python定义,因此没有C API.最好将C中的numpy ndarrays传递给您的Python代码,然后让您的Python代码从中构造pandas对象.

All the pandas classes (TimeSeries, DataFrame, DatetimeIndex etc.) have pure-Python definitions so there isn't a C API. You might be best off passing numpy ndarrays from C to your Python code and letting your Python code construct pandas objects from them.

如有必要,可以使用PyObject_CallFunction等调用pandas构造函数,但您必须注意从模块导入中访问名称并检查错误.

If necessary you could use PyObject_CallFunction etc. to call the pandas constructors, but you'd have to take care of accessing the names from module imports and checking for errors.