Skip to content

BUG: change dtype of Series from non-object to object inplace #3217

Closed
@jreback

Description

@jreback

see also #3216 , #3386

test in tests/test_series.py (test_update)

but cannot be fixed until Series is not longer a ndarray sub-class
as numpy cannot handle the float64 to object in-place dtype conversion
(which is why the sub-class issue comes up), if we have a single block
then can just swap out the block rather than attempting numpy magic here

In [18]: df = pd.DataFrame([{"a": 1}, {"a": 3, "b": 2}])
In [19]: df['c'] = np.nan
In [20]: df['c'].update(pd.Series(['foo'],index=[0]))
TypeError: Cannot change data-type for object array.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions