df = pd.read_csv(data_path, low_memory=False)
# Time characteristics
df['date'] = pd.to_datetime(df['date'])
# year
df['year'] = df['date'].map(lambda x: (x.year))
# month
df['month'] = df['date'].map(lambda x: (x.month))
# Japan
df['day'] = df['date'].map(lambda x: (x.day))
# Hours
df['hour'] = df['date'].map(lambda x: (x.hour))
# minute
df['minute'] = df['date'].map(lambda x: (x.minute))
# What day
df['dayofweek'] = df['date'].map(lambda x: (x.dayofweek+1))
The above time characteristics are numerical
Search Baidu by yourself one-hot
As shown above , Change a time variable into a point on the circumference of a two-dimensional plane . In this way, we can solve the cyclical factors .