Python dates

From Bitnami MediaWiki
Revision as of 19:54, 18 November 2023 by User (talk | contribs)
Jump to navigation Jump to search

Python dates are a notorious pain in the ass. Here's a short field guide.

Object types

When using pd.to_datetime with a text date (e.g., '2022-05-19'), the result is a *timestamp* object.

df['Date'].iloc[0] 
Timestamp('2022-05-19 00:00:00')