I have a dataframe column that looks like the following:
I'm trying to parse out the date and time from this column so that I can add both to two separate columns. How would I go about doing that?
I have a dataframe column that looks like the following:
I'm trying to parse out the date and time from this column so that I can add both to two separate columns. How would I go about doing that?
You can use a list comp to separate and then use zip to unpack into columns.
df["Date"] = pd.to_datetime(df["Date"])
df["Date"], df["Time"] = zip(*[(x.date(), x.time()) for x in df["Date"]])