save datetime day in seperate column 1

save datetime day in seperate column

df["day"] = df['datetime_utc'].map(lambda x: x.day)
df["month"] = df['datetime_utc'].map(lambda x: x.month)
df["year"] = df['datetime_utc'].map(lambda x: x.year)

Here is what the above code is Doing:
1. We’re creating a new column called “day” and mapping it to the day of the month.
2. We’re creating a new column called “month” and mapping it to the month of the year.
3. We’re creating a new column called “year” and mapping it to the year.

Similar Posts