Skip to content

object arrays converted to string arrays of 'S' dtype have default length. (Trac #1892) #2485

Closed
@numpy-gitbot

Description

@numpy-gitbot

Original ticket http://projects.scipy.org/numpy/ticket/1892 on 2011-07-04 by trac user ehiggs, assigned to unknown.

I'm sure this must have been reported before, but I can't find it in the bug tracker. The bug is that calling a vectorized function on a string type truncates the string to '|S8' regardless of the original length.

Example:

In [1]: import numpy

In [2]: def __f(x):

...: return x

...:

In [3]: f = numpy.vectorize(__f)

In [4]: s = '2011-07-04'

In [5]: y = f(s)

In [6]: y

Out[6]:
array('2011-07-04',
dtype='|S10')

In [8]: z = f(numpy.array([s,s,s,s]))

In [9]: z
Out[9]:
array(['2011-07-', '2011-07-', '2011-07-', '2011-07-'],
dtype='|S8')

If this has been raised, please merge this in so I can track progress on the original.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions