Created
February 15, 2021 20:19
-
-
Save ahmedshahriar/3caa7389304acd5f2e756abb0ccb7be4 to your computer and use it in GitHub Desktop.
This file contains 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
import pandas as pd | |
# using pandas datetime converter | |
df = pd.DataFrame(pd.Series(['2021-02-04T09:15:00+05:30', '2021-02-04T09:15:00+05:30', '2021-02-04T09:15:00+05:30'])) | |
pd.to_datetime(df[0]).dt.date | |
pd.to_datetime(df[0]).dt.time | |
# using dateutil library | |
from dateutil.parser import parse | |
df[0].map(lambda x: parse(x).date()) | |
df[0].map(lambda x: parse(x).time()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment