Skip to content

BUG: to_datetime ignores utc=True when arg is Series  #6415

Closed
@michaelaye

Description

@michaelaye

Is this a bug or a feature that I don't understand:

data = ['20100102 121314', '20100102 121315']
print (pd.to_datetime(data, format='%Y%m%d %H%M%S', 
                      utc=True)[0]).__repr__()
print (pd.to_datetime(pd.Series(data), format='%Y%m%d %H%M%S', 
                      utc=True)[0]).__repr__()
print (pd.to_datetime(pd.TimeSeries(data), format='%Y%m%d %H%M%S', 
                     utc=True)[0]).__repr__()

results in

Timestamp('2010-01-02 12:13:14+0000', tz='UTC')
Timestamp('2010-01-02 12:13:14', tz=None)
Timestamp('2010-01-02 12:13:14', tz=None)

Using version '0.13.1'


Other example in #15760

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions