[Numpy-discussion] add.reduce for character arrays

Faheem Mitha faheem at email.unc.edu
Sat Apr 17 16:07:07 CDT 2004


Hi,

The following does not work. I am trying to do something similar to
add.reduce, except that I want strings concatenated across the
appropriate axes. I was hoping that Python would "magically" recognise
that addition in strings translated to concatenation.

Incidentally, the error message is not terribly imformative.

Is there any way to make this work, or any other method people can
suggest, or do I need to write my own function? 

Thanks.
                                                     Regards, Faheem.

**********************************************************************
In [43]: s
Out[43]:
CharArray([['a', 'b', 'c'],
           ['d', 'e', 'f'],
           ['g', 'h', 'i']])

In [44]: numarray.add.reduce(s,1)
---------------------------------------------------------------------------
error                                     Traceback (most recent call
last)

/home/faheem/wc/corrmodel/boost/<console>

error: getShape: sequence object nested more than MAXDIM





More information about the Numpy-discussion mailing list