mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-09-15 22:10:22 +00:00
Update holidays data (#2179)
This commit is contained in:
parent
17b085b6db
commit
679db85047
7 changed files with 16459 additions and 5963 deletions
|
|
@ -54,4 +54,4 @@ LinkingTo:
|
||||||
LazyData: true
|
LazyData: true
|
||||||
VignetteBuilder: knitr
|
VignetteBuilder: knitr
|
||||||
Encoding: UTF-8
|
Encoding: UTF-8
|
||||||
RoxygenNote: 7.1.1
|
RoxygenNote: 7.2.0
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,10 @@
|
||||||
# LICENSE file in the root directory of this source tree.
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
|
|
||||||
#' holidays table
|
#' Generated table of holiday dates at the country level from 1995 to 2045
|
||||||
#'
|
#'
|
||||||
#' @format A data frame with five variables: ds, holiday, country, year
|
#' The data is primarily based on the Python package [holidays](https://pypi.org/project/holidays/)
|
||||||
|
#'
|
||||||
|
#' @format A data frame with four variables: ds, holiday, country, year
|
||||||
|
#' @source \url{https://github.com/facebook/prophet/blob/main/python/scripts/generate_holidays_file.py}
|
||||||
"generated_holidays"
|
"generated_holidays"
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
Binary file not shown.
|
|
@ -3,14 +3,17 @@
|
||||||
\docType{data}
|
\docType{data}
|
||||||
\name{generated_holidays}
|
\name{generated_holidays}
|
||||||
\alias{generated_holidays}
|
\alias{generated_holidays}
|
||||||
\title{holidays table}
|
\title{Generated table of holiday dates at the country level from 1995 to 2045}
|
||||||
\format{
|
\format{
|
||||||
A data frame with five variables: ds, holiday, country, year
|
A data frame with four variables: ds, holiday, country, year
|
||||||
|
}
|
||||||
|
\source{
|
||||||
|
\url{https://github.com/facebook/prophet/blob/main/python/scripts/generate_holidays_file.py}
|
||||||
}
|
}
|
||||||
\usage{
|
\usage{
|
||||||
generated_holidays
|
generated_holidays
|
||||||
}
|
}
|
||||||
\description{
|
\description{
|
||||||
holidays table
|
The data is primarily based on the Python package [holidays](https://pypi.org/project/holidays/)
|
||||||
}
|
}
|
||||||
\keyword{datasets}
|
\keyword{datasets}
|
||||||
|
|
|
||||||
|
|
@ -794,6 +794,67 @@ class PK(Pakistan):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# ------------ Holidays in Russia---------------------
|
||||||
|
class Russia(HolidayBase):
|
||||||
|
"""
|
||||||
|
Implement public holidays in Russia
|
||||||
|
Reference:
|
||||||
|
https://en.wikipedia.org/wiki/Public_holidays_in_Russia
|
||||||
|
Please note:
|
||||||
|
Orthodox Christmas Day is official day off at Russia
|
||||||
|
But the Dec. 25 Christmas is also celebrated.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
self.country = "RU"
|
||||||
|
HolidayBase.__init__(self, **kwargs)
|
||||||
|
|
||||||
|
def _populate(self, year):
|
||||||
|
# New Year's Day
|
||||||
|
name = "New Year's Day"
|
||||||
|
self[date(year, 1, 1)] = name
|
||||||
|
|
||||||
|
# Orthodox Christmas day
|
||||||
|
name = "Orthodox Christmas Day"
|
||||||
|
self[date(year, 1, 7)] = name
|
||||||
|
|
||||||
|
# Dec. 25 Christmas Day
|
||||||
|
name = "Christmas Day"
|
||||||
|
self[date(year, 12, 25)] = name
|
||||||
|
|
||||||
|
# Defender of the Fatherland Day
|
||||||
|
name = "Defender of the Fatherland Day"
|
||||||
|
self[date(year, 2, 23)] = name
|
||||||
|
|
||||||
|
# International Women's Day
|
||||||
|
name = "International Women's Day"
|
||||||
|
self[date(year, 3, 8)] = name
|
||||||
|
|
||||||
|
# National Flag Day
|
||||||
|
name = "National Flag Day"
|
||||||
|
self[date(year, 8, 22)] = name
|
||||||
|
|
||||||
|
# Spring and Labour Day
|
||||||
|
name = "Spring and Labour Day"
|
||||||
|
self[date(year, 5, 1)] = name
|
||||||
|
|
||||||
|
# Victory Day
|
||||||
|
name = "Victory Day"
|
||||||
|
self[date(year, 5, 9)] = name
|
||||||
|
|
||||||
|
# Russia Day
|
||||||
|
name = "Russia Day"
|
||||||
|
self[date(year, 6, 12)] = name
|
||||||
|
|
||||||
|
# Unity Day
|
||||||
|
name = "Unity Day"
|
||||||
|
self[date(year, 11, 4)] = name
|
||||||
|
|
||||||
|
|
||||||
|
class RU(Russia):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
# ------------ Holidays in Belarus---------------------
|
# ------------ Holidays in Belarus---------------------
|
||||||
class Belarus(HolidayBase):
|
class Belarus(HolidayBase):
|
||||||
"""
|
"""
|
||||||
|
|
@ -851,3 +912,89 @@ class Belarus(HolidayBase):
|
||||||
|
|
||||||
class BY(Belarus):
|
class BY(Belarus):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
# ------------ Holidays in Georgia---------------------
|
||||||
|
class Georgia(HolidayBase):
|
||||||
|
"""
|
||||||
|
Implement public holidays in Georgia
|
||||||
|
Reference:
|
||||||
|
https://en.wikipedia.org/wiki/Public_holidays_in_Georgia_(country)
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, **kwargs):
|
||||||
|
self.country = "GE"
|
||||||
|
HolidayBase.__init__(self, **kwargs)
|
||||||
|
|
||||||
|
def _populate(self, year):
|
||||||
|
# New Year's Day
|
||||||
|
name = "New Year's Day"
|
||||||
|
self[date(year, 1, 1)] = name
|
||||||
|
|
||||||
|
# New Year's Day
|
||||||
|
name = "Second day of the New Year"
|
||||||
|
self[date(year, 1, 2)] = name
|
||||||
|
|
||||||
|
# Christmas Day (Orthodox)
|
||||||
|
name = "Orthodox Christmas"
|
||||||
|
self[date(year, 1, 7)] = name
|
||||||
|
|
||||||
|
# Baptism Day of our Lord Jesus Christ
|
||||||
|
name = "Baptism Day of our Lord Jesus Christ"
|
||||||
|
self[date(year, 1, 19)] = name
|
||||||
|
|
||||||
|
# Mother's Day
|
||||||
|
name = "Mother's Day"
|
||||||
|
self[date(year, 3, 3)] = name
|
||||||
|
|
||||||
|
# Women's Day
|
||||||
|
name = "International Women's Day"
|
||||||
|
self[date(year, 3, 8)] = name
|
||||||
|
|
||||||
|
# Orthodox Good Friday
|
||||||
|
name = "Good Friday"
|
||||||
|
self[easter(year, EASTER_ORTHODOX) - timedelta(days=2)] = name
|
||||||
|
|
||||||
|
# Orthodox Holy Saturday
|
||||||
|
name = "Great Saturday"
|
||||||
|
self[easter(year, EASTER_ORTHODOX) - timedelta(days=1)] = name
|
||||||
|
|
||||||
|
# Orthodox Easter Sunday
|
||||||
|
name = "Easter Sunday"
|
||||||
|
self[easter(year, EASTER_ORTHODOX)] = name
|
||||||
|
|
||||||
|
# Orthodox Easter Monday
|
||||||
|
name = "Easter Monday"
|
||||||
|
self[easter(year, EASTER_ORTHODOX) + timedelta(days=1)] = name
|
||||||
|
|
||||||
|
# National Unity Day
|
||||||
|
name = "National Unity Day"
|
||||||
|
self[date(year, 4, 9)] = name
|
||||||
|
|
||||||
|
# Day of Victory
|
||||||
|
name = "Victory Day"
|
||||||
|
self[date(year, 5, 9)] = name
|
||||||
|
|
||||||
|
# Saint Andrew the First-Called Day
|
||||||
|
name = "Saint Andrew the First-Called Day"
|
||||||
|
self[date(year, 5, 12)] = name
|
||||||
|
|
||||||
|
# Independence Day
|
||||||
|
name = "Independence Day"
|
||||||
|
self[date(year, 5, 26)] = name
|
||||||
|
|
||||||
|
# Saint Mary's Day
|
||||||
|
name = "Saint Mary's Day"
|
||||||
|
self[date(year, 8, 28)] = name
|
||||||
|
|
||||||
|
# Day of Svetitskhoveli Cathedral
|
||||||
|
name = "Day of Svetitskhoveli Cathedral"
|
||||||
|
self[date(year, 10, 14)] = name
|
||||||
|
|
||||||
|
# Saint George's Day
|
||||||
|
name = "Saint George's Day"
|
||||||
|
self[date(year, 12, 23)] = name
|
||||||
|
|
||||||
|
|
||||||
|
class GE(Georgia):
|
||||||
|
pass
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,10 @@ def generate_holidays_file():
|
||||||
|
|
||||||
# Convert to ASCII, and drop holidays that fail to convert
|
# Convert to ASCII, and drop holidays that fail to convert
|
||||||
generated_holidays['holiday'] = generated_holidays['holiday'].apply(utf8_to_ascii)
|
generated_holidays['holiday'] = generated_holidays['holiday'].apply(utf8_to_ascii)
|
||||||
|
failed_countries = generated_holidays.loc[generated_holidays['holiday'] == 'FAILED_TO_PARSE', 'country'].unique()
|
||||||
|
if failed_countries:
|
||||||
|
print("Failed to convert UTF-8 holidays for:")
|
||||||
|
print('\n'.join(failed_countries))
|
||||||
assert 'FAILED_TO_PARSE' not in generated_holidays['holiday'].unique()
|
assert 'FAILED_TO_PARSE' not in generated_holidays['holiday'].unique()
|
||||||
generated_holidays.to_csv("../R/data-raw/generated_holidays.csv", index=False)
|
generated_holidays.to_csv("../R/data-raw/generated_holidays.csv", index=False)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue