Pass numeric arrays from C extensions to Python

Grant Edwards invalid at invalid.invalid
Mon Sep 24 10:55:37 EDT 2012


On 2012-09-24, JBT <jianbao.tao at gmail.com> wrote:

> I am looking for a way to pass numeric arrays, such as *float a[100];
> double b[200];*, from C extension codes to python. The use case of
> this problem is that you have data stored in a particular format,
> NASA common data format (CDF) in my case, and there exists an
> official C library to read/create/edit such data, and you want to do
> data analysis in python. The problem comes down to how to feed the
> data into python.

In a addition to scipy and scientific python (two different projects),
you should probably take a look at the struct module and the ctypes
module.

-- 
Grant Edwards               grant.b.edwards        Yow! Life is a POPULARITY
                                  at               CONTEST!  I'm REFRESHINGLY
                              gmail.com            CANDID!!



More information about the Python-list mailing list