Skip to content

to_datetime passed string return datetime rather than Timestamp #3888

Closed
@hayd

Description

@hayd

It seems it returns different objects when passed array vs string:

In [1]: pd.to_datetime(['2012'])[0]
Out[1]: Timestamp('2012-01-01 00:00:00', tz=None)

In [2]: pd.to_datetime('2012')
Out[2]: datetime.datetime(2012, 1, 1, 0, 0)

Also worth mentioning (though different):

In [3]: pd.Timestamp('2012')
Out[3]: Timestamp('2012-06-13 00:00:00', tz=None)

Seems a little inconsistent... (cc #3859)

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