data_loader.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:kino-bot 作者: DongjunLee 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号