Skip to content

numpy.place - strange behaviour with array of strings #6974

@WojciechMigda

Description

@WojciechMigda

I am using:

  • Python 2.7.10 (default, Oct 14 2015, 16:09:02) [GCC 5.2.1 20151010] on linux2
  • numpy 1.10.1
  • Linux wojtek-dell 3.13.0-66-generic #108-Ubuntu SMP Wed Oct 7 15:20:27 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Given this snippet:

import numpy as np
arr = np.array(['12', '34'])
np.place(arr, np.array([False, True]), '9')
print arr

I would imagine that arr will equal ['12' '9'], but instead it is ['12' '94'].
Similar code with numpy.putmaskgives expected ['12' '9'].
Is this a designed behaviour of numpy.place?

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