Python dates

From Bitnami MediaWiki
Revision as of 19:54, 18 November 2023 by User (talk | contribs) (Created page with "Python dates are a notorious pain in the ass. Here's a short field guide. ===Object types=== When using <code> pd.to_datetime </code> with a text date (e.g., '2022-05-19'), t...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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. <syntaxhighlight, lang=Python> df['Date'].iloc[0] Timestamp('2022-05-19 00:00:00') </syntaxhighlight>