2009/3/24 Dan Yamins <dyam...@gmail.com>

> Hi all,
>
> I'm having a seg fault error from numpy.rec.fromarrays.
>
> I have a python list
>     L = [Col1, Col2]
> where Col1 and Col2 are python lists of short strings (the max length of
> Col1 strings is 4 chars and max length of Col2 is 7 chars).  The len of Col1
> and Col2 is about 11500.
>
> Then I attempt
>    >>> A = numpy.rec.fromarrays(L,names = ['Aggregates','__color__'])
>
> This should produce a  numpy record array with two columns, one called
> 'Aggregates', the other called '__color__'.
>
> In and of it self, this runs.  But then when I attempt to look at the
> contents of A, running the __getitem__ method, say by doing:
>
>    >>> print A
> or
>    >>> A.tolist()
> or
>    >>> A[0]
>
> then I get a seg fault error.  (Acutally, the segfault only occurs about
> 80% of the time I run these commands.)
>
> However, the __getitem__ method does work to produce attribute arrays from
> column names , e.g.
>
>   >>> Ag =  A['Aggregates']
>
> or
>
>   >>> col =  A['__color__']
>
> both produce (apparently) completely correct and working numpy arrays.
>
> Moreover, If I pickle the object A before looking at it, everything works
> fine.   E.g. if I execute:
>
>    >>> Hold_A = A.dumps()
>    >>> A = numpy.loads(Hold_A)
>
> then A seems to work fine.
>
> (Also:  pickling the list L = [Col1,Col2] first, before running the
> numpy.rec.fromarrays method, does not always fix the segfault.)
>
>
> Can someone explain why this might be happening, and how I can fix it
> (without having to use the pickling hack)?
>

What architecture/operating system is this?

Chuck
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to