Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

判断是否是有休息的特殊节日 #30

Open
eromoe opened this issue Nov 9, 2018 · 3 comments
Open

判断是否是有休息的特殊节日 #30

eromoe opened this issue Nov 9, 2018 · 3 comments

Comments

@eromoe
Copy link

eromoe commented Nov 9, 2018

因为目前没有这个接口,所以只能查节日名 ,
但是我在数据里发现有个这个

    datetime.date(year=2015, month=9, day=3): Holiday.anti_fascist_70th_day.value,
    datetime.date(year=2015, month=9, day=4): Holiday.anti_fascist_70th_day.value,

我不记得15年有休过这个假日。。。
因为我是做数据分析的,要把特殊休息的节假日剔除掉,所以有用。


百度了一下,有说当时有调休。。。搞不清楚了

@LKI
Copy link
Owner

LKI commented Nov 9, 2018

唔,我印象中当时的确休过70周年反法西斯的假期……


至于本 issue 说的 “判断是否有休息的特殊节日” 大概是个啥概念的方法?
没太看懂…求详细介绍

@eromoe
Copy link
Author

eromoe commented Nov 9, 2018

真有休息那应该是没问题啦。(度娘是说有应该就有,我记不清楚)

剩下的问题就是,区分特殊节假日和一般节假日
一般节假日:周末
特殊节假日:春节,国庆,劳动节====

代码就是:

def is_special_holiday(d):
    h, n = get_holiday_detail(d)
    return h and n is not None

这里不能只用get_holiday_detail 的第二个值来判断,因为

calendar.get_holiday_detail(date(2018, 9, 29))
(False, 'National Day')

这里也很奇怪,9.29是不休息的国庆节。。。

@LKI
Copy link
Owner

LKI commented Nov 9, 2018

噢噢噢,非常科学的需求!
我其实也觉得目前的 holiday detail 实现的很蠢……

我想想哈~有更新的话会 link 这个 issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants