Skip to content

int32/64 cast issue #4384

Open
Open
@dsm054

Description

@dsm054

This is related to #4328, I think:

>>> np.__version__
'1.9.0.dev-3a2f048'
>>> a = np.array([1,2,3], dtype=np.int64)
>>> np.repeat(a, a)
Traceback (most recent call last):
  File "<ipython-input-23-739b853dec18>", line 1, in <module>
    np.repeat(a, a)
  File "/usr/local/lib/python2.7/dist-packages/numpy/core/fromnumeric.py", line 391, in repeat
    return repeat(repeats, axis)
TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'

>>> np.repeat(a, a.astype('int32'))
array([1, 2, 2, 3, 3, 3], dtype=int64)

with configuration

python: 2.7.3.final.0
python-bits: 32
OS: Linux
OS-release: 3.2.0-58-generic-pae
machine: i686
processor: i686
byteorder: little
LC_ALL: None
LANG: en_CA.UTF-8
numpy: 1.9.0.dev-3a2f048

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions