8000 np.full and object arrays · Issue #6366 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
np.full and object arrays #6366
@anntzer

Description

@anntzer

np.full says that the resulting array's dtype is np.array(fill_value).dtype without mention of object arrays, but

In [1]: np.full((1,), None)
Out[1]: array([ nan])

and

In [2]: class C: pass

In [3]: np.full((1,), C())
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-e364c2e90930> in <module>()
----> 1 np.full((1,), C())

/usr/lib/python3.4/site-packages/numpy/core/numeric.py in full(shape, fill_value, dtype, order)
    286     """
    287     a = empty(shape, dtype, order)
--> 288     multiarray.copyto(a, fill_value, casting='unsafe')
    289     return a
    290 

TypeError: float() argument must be a string or a number, not 'C'

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

      0