Skip to content

BUG: New ragged array message has false positives #14138

@seberg

Description

@seberg

A related effect of this change is that assigning a ragged list (but still of correct number of values) to a slice no longer works, as shown in this example, extracted from Matplotlib's tests:

points = np.array([[1, 2], [3, 6]])

xlim = points[:, 0]
ylim = points[:, 1]
edge_size = max(np.diff(xlim), np.diff(ylim))

interval = [xlim[0], xlim[0] + edge_size]

points[:, 0] = interval
# print(repr(points)) formerly gave:
# array([[1, 2],
#        [5, 6]])

fails with a ValueError because the first element is a scalar and the second element is an array of length one.

I wrote a fix for this, but a question did come up for whether this was an intended change?

Originally posted by @QuLogic in #13913 (comment)

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