Last active
February 1, 2023 09:10
-
-
Save sakurai-youhei/a15ff005ee18d69a073d90246bfd67ef to your computer and use it in GitHub Desktop.
Cross validation of python-shukujitsu
This file contains hidden or 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
from datetime import date | |
from difflib import unified_diff | |
import jpholiday | |
import shukujitsu | |
a = [] | |
for day in shukujitsu.Japan()["1990-1-1": "2024-12-31"]: | |
a.append("{}\n".format(day)) | |
b = [] | |
for day, name in jpholiday.between(date(1990, 1, 1), date(2024, 12, 31)): | |
b.append("{}\n".format(day)) | |
print(*unified_diff(a, b, | |
fromfile="python-shukujitsu {}".format(shukujitsu.__version__), | |
tofile="jpholiday {}".format(jpholiday.__version__))) |
This file contains hidden or 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
from difflib import unified_diff | |
import holidays | |
import shukujitsu | |
a = [] | |
for day in shukujitsu.Japan()["1990-1-1": "2024-12-31"]: | |
a.append("{}\n".format(day)) | |
b = [] | |
for day in holidays.Japan(years=range(1991, 2022))["1990-1-1": "2024-12-31"]: | |
b.append("{}\n".format(day)) | |
print(*unified_diff(a, b, | |
fromfile="python-shukujitsu {}".format(shukujitsu.__version__), | |
tofile="python-holidays {}".format(holidays.__version__))) |
This file contains hidden or 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
from difflib import unified_diff | |
from itertools import chain | |
import workalendar.asia | |
import shukujitsu | |
a = [] | |
for day in shukujitsu.Japan()["1990-1-1": "2024-12-31"]: | |
a.append("{}\n".format(day)) | |
b = [] | |
cal = workalendar.asia.Japan() | |
for day, name in chain.from_iterable(map(cal.holidays, range(1990, 2024 + 1))): | |
b.append("{}\n".format(day)) | |
print(*unified_diff(a, b, | |
fromfile="python-shukujitsu {}".format(shukujitsu.__version__), | |
tofile="workalendar {}".format(workalendar.__version__))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment