Skip to content

Possible problem with ragged-array as object deprecation #15041

Closed
@mhvk

Description

@mhvk

#14794 deprecated auto-creation of object arrays for ragged lists (hurray!!), which, perhaps not surprisingly is causing some test failures in astropy. We can address all those without problem (two out of three just need being more careful with the test), but I wasn't entirely sure whether a deprecation warning should be expected for the following:

import numpy as np
lofo = [1, [2, 3]]
a = np.array(lofo, dtype=object)
a == lofo
# /usr/bin/ipython3:1: DeprecationWarning: Creating an ndarray with automatic object dtype is deprecated, use dtype=object if you intended it, otherwise specify an exact dtype
# array([ True,  True])

In this case, arguably the intent is unambiguous: since one array is an object array, the list might as well be interpreted as an object array.

But it also seems fine to just be strict, so no problem if this is not fixed.

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