Skip to content

dtype of np.random.choice differs with presence of p on windows #9867

@jcrist

Description

@jcrist

The dtype of the output of np.random.choice with a scalar a is different if p is provided on windows:

>>> import numpy as np
>>> p = np.array([0.5, 0.5])
>>> np.random.choice(2, size=1).dtype
dtype('int32')
>>> np.random.choice(2, p=p, size=1).dtype
dtype('int64')
>>> np.__version__
1.13.1

I'd expect the output dtype to be consistent whether p is present or absent. Since the dtype of arange on win32 is int32, the int64 dtype output is probably the incorrect one.

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