def convert_data(self, line, prev_func):
datetime_pattern = '\d+-\d+-\d+ \d+:\d+'
r = re.findall(datetime_pattern, line)
if len(r) == 0:
return None
t = arrow.get(r[0], tzinfo=tz.tzlocal())
day_of_week = t.isoweekday()
hour = int(t.format('HH'))
minute = int(t.format('mm'))
if day_of_week == 6 or day_of_week == 7:
is_holiday = 1
else:
is_holiday = 0
return np.array([day_of_week, hour, minute, prev_func,
is_holiday], dtype=np.int32)
评论列表
文章目录