Created
November 5, 2021 01:47
-
-
Save ycui1/58c17c4e5cd8ee89c3a1e26b4a858d22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> 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