NumPy and vectorize

C

Carl Johan Rehn

I'm having problem with the return values of NumPy's vectorize
function. When I pass an array of strings in the following simple
example, vectorize truncates the strings in the returned list. Any
clues of what to do?

Yours, Carl


import numpy as np

def __f(x):
return x

f = vectorize(__f)

s = '2010-04-28'
y1 = f(s)
y2 = f(np.array([s, s, s, s]))

In [62]: y1
Out[62]:
array('2010-04-28',
dtype='|S10')

In [63]: y2
Out[63]:
array(['2010-04-', '2010-04-', '2010-04-', '2010-04-'],
dtype='|S8')
 
R

Robert Kern

I'm having problem with the return values of NumPy's vectorize
function. When I pass an array of strings in the following simple
example, vectorize truncates the strings in the returned list. Any
clues of what to do?

You will want to report numpy bugs to the numpy mailing list:

http://www.scipy.org/Mailing_Lists

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top