O'Reilly logo

Learning pandas - Second Edition by Michael Heydt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Representing a point in time with a Timestamp

The representation of date and time in pandas is performed using the pandas.tslib.Timestamp class. A pandas Timestamp is based on the datetime64 dtype and has higher precision than the Python datetime object. In pandas, Timestamp objects are generally interchangeable with datetime objects, so you can typically use them wherever you may use datetime objects.

You can create a Timestamp object using pd.Timestamp (a shortcut for pandas.tslib.Timestamp) and by passing a string representing a date, time, or date and time:

A time element can also be specified:

A Timestamp can also be created using just ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required