Skip to content

Instantly share code, notes, and snippets.

@ycui1
Created November 5, 2021 01:47
Show Gist options
  • Save ycui1/58c17c4e5cd8ee89c3a1e26b4a858d22 to your computer and use it in GitHub Desktop.
Save ycui1/58c17c4e5cd8ee89c3a1e26b4a858d22 to your computer and use it in GitHub Desktop.
>>> data = {"timestamp": ["01/01/2022 09:01:00", "01/02/2022 08:55:44", "05/01/2022 22:01:00"],
... "category": list('ABC')}
>>> df = pd.DataFrame(data)
>>> df.dtypes
timestamp object
category object
dtype: object
>>> df["timestamp"] = pd.to_datetime(df["timestamp"])
>>> df.dtypes
timestamp datetime64[ns]
category object
dtype: object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment