Pandas Convert Timestamp to Datetime

Feb 24, 2021
import datetimeimport pandas as pditems = [  {'date': datetime.datetime(2020, 1, 1), 'score': 1},  {'date': datetime.datetime(2020, 1, 2), 'score': 2},  {'date': datetime.datetime(2020, 1, 3), 'score': 3}]df = pd.DataFrame(items) df['date'][0]  # Timestamp('2020-01-01 00:00:00')df['date'][0].to_pydatetime() # datetime.datetime(2020, 1, 1, 0, 0)

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.

Tags