Skip to content

repr change for arrays of size 1 even with np.set_printoptions(legacy=True) in numpy master #10026

Closed
@lesteve

Description

@lesteve

In scikit-learn we have seen failures in doctests for a few days on our build using numpy-dev. This is one of them:

import numpy as np

try:
    np.set_printoptions(legacy=True)
except Exception:
    pass

print(repr(np.array([0.])))
print(repr(np.array([[0.]])))
print(repr(np.array([1., 2., 3.])))

With numpy master:

array([0.])
array([[0.]])
array([ 1.,  2.,  3.])

With numpy 1.13 (note the space before the 0):

array([ 0.])
array([[ 0.]])
array([ 1.,  2.,  3.])

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