Skip to content

Series[datetime64[ns, tz]].__setitem__ fails to coerce for ndarray value #23932

Closed
@TomAugspurger

Description

@TomAugspurger

What's the expected output for

In [9]: a = pd.Series(pd.DatetimeIndex(['2000', '2000'], tz="UTC"))

In [10]: a.loc[:] = np.array([pd.Timestamp('2000', tz="UTC")] * 2)

On master, we coerce self to object and then set.

In [11]: a
Out[11]:
0    2000-01-01 00:00:00+00:00
1    2000-01-01 00:00:00+00:00
dtype: object

Should we instead coerce value, rather than self?

Metadata

Metadata

Assignees

No one assigned

    Labels

    DatetimeDatetime data dtypeDtype ConversionsUnexpected or buggy dtype conversionsExtensionArrayExtending pandas with custom dtypes or arrays.IndexingRelated to indexing on series/frames, not to indexes themselves

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions