Skip to content

BUG: scalar assignment of a tz-aware is object dtype #19843

@jreback

Description

@jreback

[3] should be a datetime64[ns, UTC]

In [1]: df = pd.DataFrame({'A': [0, 1]}) In [3]: df['now'] = pd.Timestamp('20130101', tz='UTC') In [4]: df Out[4]: A now 0 0 2013-01-01 00:00:00+00:00 1 1 2013-01-01 00:00:00+00:00 In [5]: df.dtypes Out[5]: A int64 now object dtype: object In [6]: df['now2'] = pd.DatetimeIndex([pd.Timestamp('20130101', tz='UTC')]).repeat(len(df)) In [7]: df.dtypes Out[7]: A int64 now object now2 datetime64[ns, UTC] dtype: object 

Metadata

Metadata

Assignees

No one assigned

    Labels

    DatetimeDatetime data dtypeDtype ConversionsUnexpected or buggy dtype conversionsTimezonesTimezone data dtype

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions