Last active
February 21, 2019 02:59
-
-
Save lppier/bc8a323c7434319ad7f8e2f5212d77b3 to your computer and use it in GitHub Desktop.
Converting datetime to day of week
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 calendar | |
df_weekly_season['DOW_ENG'] = weekly_season['ds'].apply(lambda x : calendar.day_name[pd.to_datetime(x).weekday()]) | |
df_weekly_season['DOW'] = weekly_season['ds'].apply(lambda x : int(pd.to_datetime(x).strftime('%w'))) # SUN == 0 | |
df_weekly_season['DOW'] = weekly_season['ds'].apply(lambda x : int(pd.to_datetime(x).weekday()) # MON == 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment