pandas-market-calendars 4.3.0__py3-none-any.whl → 4.3.1__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- pandas_market_calendars/calendars/__init__.py +0 -0
- pandas_market_calendars/calendars/asx.py +63 -0
- pandas_market_calendars/calendars/bmf.py +227 -0
- pandas_market_calendars/calendars/bse.py +409 -0
- pandas_market_calendars/calendars/cboe.py +115 -0
- pandas_market_calendars/calendars/cme.py +240 -0
- pandas_market_calendars/calendars/cme_globex_agriculture.py +103 -0
- pandas_market_calendars/calendars/cme_globex_base.py +103 -0
- pandas_market_calendars/calendars/cme_globex_crypto.py +147 -0
- pandas_market_calendars/calendars/cme_globex_energy_and_metals.py +138 -0
- pandas_market_calendars/calendars/cme_globex_equities.py +104 -0
- pandas_market_calendars/calendars/cme_globex_fixed_income.py +113 -0
- pandas_market_calendars/calendars/cme_globex_fx.py +78 -0
- pandas_market_calendars/calendars/eurex.py +119 -0
- pandas_market_calendars/calendars/hkex.py +408 -0
- pandas_market_calendars/calendars/ice.py +65 -0
- pandas_market_calendars/calendars/iex.py +98 -0
- pandas_market_calendars/calendars/jpx.py +103 -0
- pandas_market_calendars/calendars/lse.py +91 -0
- pandas_market_calendars/calendars/mirror.py +114 -0
- pandas_market_calendars/calendars/nyse.py +1127 -0
- pandas_market_calendars/calendars/ose.py +150 -0
- pandas_market_calendars/calendars/sifma.py +297 -0
- pandas_market_calendars/calendars/six.py +114 -0
- pandas_market_calendars/calendars/sse.py +290 -0
- pandas_market_calendars/calendars/tase.py +195 -0
- pandas_market_calendars/calendars/tsx.py +159 -0
- pandas_market_calendars/holidays/__init__.py +0 -0
- pandas_market_calendars/holidays/cme.py +340 -0
- pandas_market_calendars/holidays/cme_globex.py +198 -0
- pandas_market_calendars/holidays/cn.py +1436 -0
- pandas_market_calendars/holidays/jp.py +396 -0
- pandas_market_calendars/holidays/jpx_equinox.py +147 -0
- pandas_market_calendars/holidays/nyse.py +1472 -0
- pandas_market_calendars/holidays/oz.py +65 -0
- pandas_market_calendars/holidays/sifma.py +321 -0
- pandas_market_calendars/holidays/uk.py +180 -0
- pandas_market_calendars/holidays/us.py +360 -0
- {pandas_market_calendars-4.3.0.dist-info → pandas_market_calendars-4.3.1.dist-info}/METADATA +1 -1
- pandas_market_calendars-4.3.1.dist-info/RECORD +49 -0
- pandas_market_calendars-4.3.0.dist-info/RECORD +0 -11
- {pandas_market_calendars-4.3.0.dist-info → pandas_market_calendars-4.3.1.dist-info}/LICENSE +0 -0
- {pandas_market_calendars-4.3.0.dist-info → pandas_market_calendars-4.3.1.dist-info}/NOTICE +0 -0
- {pandas_market_calendars-4.3.0.dist-info → pandas_market_calendars-4.3.1.dist-info}/WHEEL +0 -0
- {pandas_market_calendars-4.3.0.dist-info → pandas_market_calendars-4.3.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,396 @@
|
|
1
|
+
from dateutil.relativedelta import MO
|
2
|
+
from pandas import DateOffset, Timestamp
|
3
|
+
from pandas.tseries.holiday import Holiday, sunday_to_monday
|
4
|
+
|
5
|
+
from pandas_market_calendars.holidays.jpx_equinox import autumnal_citizen_dates, autumnal_equinox, vernal_equinox
|
6
|
+
|
7
|
+
AscensionDays = [
|
8
|
+
Timestamp('2019-04-30', tz='UTC'), # National Holiday
|
9
|
+
Timestamp('2019-05-01', tz='UTC'), # Ascension Day
|
10
|
+
Timestamp('2019-05-02', tz='UTC'), # National Holiday
|
11
|
+
]
|
12
|
+
|
13
|
+
MarriageDays = [
|
14
|
+
Timestamp('1959-04-10', tz='UTC'), # Akihito
|
15
|
+
Timestamp('1993-06-09', tz='UTC'), # Naruhito
|
16
|
+
]
|
17
|
+
|
18
|
+
FuneralShowa = [
|
19
|
+
Timestamp('1989-02-24', tz='UTC'),
|
20
|
+
]
|
21
|
+
|
22
|
+
EnthronementDays = [
|
23
|
+
Timestamp('1990-11-12', tz='UTC'), # Akihito
|
24
|
+
Timestamp('2019-10-22', tz='UTC') # Naruhito
|
25
|
+
]
|
26
|
+
|
27
|
+
AutumnalCitizenDates = autumnal_citizen_dates()
|
28
|
+
|
29
|
+
NoN225IndexPrices = [
|
30
|
+
# source: https://indexes.nikkei.co.jp/en/nkave/archives/data
|
31
|
+
# TODO: determine if these dates were also national holidays
|
32
|
+
Timestamp('1951-02-15', tz='UTC'),
|
33
|
+
Timestamp('1953-02-09', tz='UTC'),
|
34
|
+
Timestamp('1954-10-26', tz='UTC'),
|
35
|
+
Timestamp('1959-04-10', tz='UTC'),
|
36
|
+
]
|
37
|
+
|
38
|
+
EquityTradingSystemFailure = [
|
39
|
+
# The Failure of Equity Trading System on October 1, 2020
|
40
|
+
# source: https://www.jpx.co.jp/english/corporate/news/news-releases/0060/20201019-01.html
|
41
|
+
Timestamp('2020-10-01', tz='UTC'),
|
42
|
+
]
|
43
|
+
|
44
|
+
JapanNewYearsDay2 = Holiday(
|
45
|
+
name="New Year's Day",
|
46
|
+
month=1,
|
47
|
+
day=2,
|
48
|
+
observance=sunday_to_monday,
|
49
|
+
)
|
50
|
+
|
51
|
+
JapanNewYearsDay3 = Holiday(
|
52
|
+
name="New Year's Day",
|
53
|
+
month=1,
|
54
|
+
day=3,
|
55
|
+
)
|
56
|
+
|
57
|
+
JapanComingOfAgeDay1951To1973 = Holiday(
|
58
|
+
name="Coming of Age Day",
|
59
|
+
month=1,
|
60
|
+
day=15,
|
61
|
+
start_date=Timestamp(1951, 1, 1),
|
62
|
+
end_date=Timestamp(1973, 12, 31)
|
63
|
+
)
|
64
|
+
|
65
|
+
JapanComingOfAgeDay1974To1999 = Holiday(
|
66
|
+
name="Coming of Age Day",
|
67
|
+
month=1,
|
68
|
+
day=15,
|
69
|
+
start_date=Timestamp(1974, 1, 1),
|
70
|
+
end_date=Timestamp(1999, 12, 31),
|
71
|
+
observance=sunday_to_monday,
|
72
|
+
)
|
73
|
+
|
74
|
+
JapanComingOfAgeDay = Holiday( # second monday of january
|
75
|
+
name="Coming of Age Day",
|
76
|
+
month=1,
|
77
|
+
day=1,
|
78
|
+
start_date=Timestamp(2000, 1, 1),
|
79
|
+
offset=DateOffset(weekday=MO(2)),
|
80
|
+
)
|
81
|
+
|
82
|
+
JapanNationalFoundationDay1969To1973 = Holiday(
|
83
|
+
name="National Foundation Day",
|
84
|
+
month=2,
|
85
|
+
day=11,
|
86
|
+
start_date=Timestamp(1969, 1, 1), # also held 1872 to 1948 as Kigen-setsu
|
87
|
+
end_date=Timestamp(1973, 12, 31),
|
88
|
+
)
|
89
|
+
|
90
|
+
JapanNationalFoundationDay = Holiday(
|
91
|
+
name="National Foundation Day",
|
92
|
+
month=2,
|
93
|
+
day=11,
|
94
|
+
start_date=Timestamp(1974, 1, 1),
|
95
|
+
observance=sunday_to_monday,
|
96
|
+
)
|
97
|
+
|
98
|
+
JapanEmperorsBirthday = Holiday(
|
99
|
+
name="The Emperor's Birthday",
|
100
|
+
month=2,
|
101
|
+
day=23,
|
102
|
+
start_date=Timestamp(2020, 1, 1),
|
103
|
+
observance=sunday_to_monday,
|
104
|
+
)
|
105
|
+
|
106
|
+
JapanVernalEquinox = Holiday(
|
107
|
+
name="Vernal Equinox",
|
108
|
+
month=3,
|
109
|
+
day=20,
|
110
|
+
observance=vernal_equinox
|
111
|
+
)
|
112
|
+
|
113
|
+
JapanShowaDayUntil1972 = Holiday(
|
114
|
+
name="Showa Day",
|
115
|
+
month=4,
|
116
|
+
day=29,
|
117
|
+
end_date=Timestamp(1972, 12, 31) # 1965
|
118
|
+
)
|
119
|
+
|
120
|
+
JapanShowaDay = Holiday(
|
121
|
+
name="Showa Day",
|
122
|
+
month=4,
|
123
|
+
day=29,
|
124
|
+
start_date=Timestamp(1973, 1, 1),
|
125
|
+
observance=sunday_to_monday,
|
126
|
+
)
|
127
|
+
|
128
|
+
JapanConstitutionMemorialDayUntil1972 = Holiday(
|
129
|
+
name="Constitution Memorial Day",
|
130
|
+
month=5,
|
131
|
+
day=3,
|
132
|
+
start_date=Timestamp(1948, 1, 1),
|
133
|
+
end_date=Timestamp(1972, 12, 31),
|
134
|
+
)
|
135
|
+
|
136
|
+
JapanConstitutionMemorialDay = Holiday(
|
137
|
+
name="Constitution Memorial Day",
|
138
|
+
month=5,
|
139
|
+
day=3,
|
140
|
+
start_date=Timestamp(1973, 1, 1),
|
141
|
+
observance=sunday_to_monday,
|
142
|
+
)
|
143
|
+
|
144
|
+
JapanGreeneryDay = Holiday(
|
145
|
+
name="Greenery Day", # prior to 1985 was a Citizen's Day
|
146
|
+
month=5,
|
147
|
+
day=4,
|
148
|
+
start_date=Timestamp(1985, 1, 1),
|
149
|
+
observance=sunday_to_monday,
|
150
|
+
)
|
151
|
+
|
152
|
+
JapanChildrensDayUntil1972 = Holiday(
|
153
|
+
name="Children's Day",
|
154
|
+
month=5,
|
155
|
+
day=5,
|
156
|
+
start_date=Timestamp(1948, 1, 1),
|
157
|
+
end_date=Timestamp(1972, 12, 31),
|
158
|
+
)
|
159
|
+
|
160
|
+
JapanChildrensDay = Holiday(
|
161
|
+
name="Children's Day",
|
162
|
+
month=5,
|
163
|
+
day=5,
|
164
|
+
start_date=Timestamp(1973, 1, 1),
|
165
|
+
observance=sunday_to_monday,
|
166
|
+
)
|
167
|
+
|
168
|
+
# starting in 2007, there can be a holiday on May 6 if May 3 or 4 falls on a Sunday
|
169
|
+
JapanGoldenWeekBonusDay = Holiday(
|
170
|
+
name="Golden Week Bonus Day",
|
171
|
+
month=5,
|
172
|
+
day=6,
|
173
|
+
start_date=Timestamp(2007, 1, 1),
|
174
|
+
days_of_week=(1, 2),
|
175
|
+
)
|
176
|
+
|
177
|
+
JapanMarineDay1996To2002 = Holiday(
|
178
|
+
name="Marine Day",
|
179
|
+
month=7,
|
180
|
+
day=20,
|
181
|
+
start_date=Timestamp(1996, 1, 1),
|
182
|
+
end_date=Timestamp(2002, 12, 31),
|
183
|
+
observance=sunday_to_monday,
|
184
|
+
)
|
185
|
+
|
186
|
+
JapanMarineDay2003To2019 = Holiday(
|
187
|
+
name="Marine Day",
|
188
|
+
month=7,
|
189
|
+
day=1,
|
190
|
+
start_date=Timestamp(2003, 1, 1),
|
191
|
+
end_date=Timestamp(2019, 12, 31),
|
192
|
+
offset=DateOffset(weekday=MO(3)),
|
193
|
+
)
|
194
|
+
|
195
|
+
JapanMarineDay2020 = Holiday(
|
196
|
+
name="Marine Day", # shift for Olympics
|
197
|
+
year=2020,
|
198
|
+
month=7,
|
199
|
+
day=23,
|
200
|
+
)
|
201
|
+
|
202
|
+
JapanMarineDay2021 = Holiday(
|
203
|
+
name="Marine Day", # shift for Olympics (Olympics and Paralympics postponed until 2021 due to the COVID-19 pandemic)
|
204
|
+
year=2021,
|
205
|
+
month=7,
|
206
|
+
day=22,
|
207
|
+
)
|
208
|
+
|
209
|
+
JapanMarineDay = Holiday(
|
210
|
+
name="Marine Day",
|
211
|
+
month=7,
|
212
|
+
day=1,
|
213
|
+
start_date=Timestamp(2022, 1, 1),
|
214
|
+
offset=DateOffset(weekday=MO(3)),
|
215
|
+
)
|
216
|
+
|
217
|
+
JapanMountainDay2016to2019 = Holiday(
|
218
|
+
name="Mountain Day",
|
219
|
+
month=8,
|
220
|
+
day=11,
|
221
|
+
start_date=Timestamp(2016, 1, 1),
|
222
|
+
end_date=Timestamp(2019, 12, 31),
|
223
|
+
observance=sunday_to_monday,
|
224
|
+
)
|
225
|
+
|
226
|
+
JapanMountainDay2020 = Holiday(
|
227
|
+
name="Mountain Day", # shift for Olympics
|
228
|
+
year=2020,
|
229
|
+
month=8,
|
230
|
+
day=10,
|
231
|
+
)
|
232
|
+
|
233
|
+
JapanMountainDay2021 = Holiday(
|
234
|
+
name="Mountain Day", # shift for Olympics (Olympics and Paralympics postponed until 2021 due to the COVID-19 pandemic)
|
235
|
+
year=2021,
|
236
|
+
month=8,
|
237
|
+
day=8,
|
238
|
+
)
|
239
|
+
|
240
|
+
JapanMountainDay2021NextDay = Holiday(
|
241
|
+
name="Mountain Day", # shift for Olympics (Olympics and Paralympics postponed until 2021 due to the COVID-19 pandemic)
|
242
|
+
year=2021,
|
243
|
+
month=8,
|
244
|
+
day=9,
|
245
|
+
)
|
246
|
+
|
247
|
+
JapanMountainDay = Holiday(
|
248
|
+
name="Mountain Day",
|
249
|
+
month=8,
|
250
|
+
day=11,
|
251
|
+
start_date=Timestamp(2022, 1, 1),
|
252
|
+
observance=sunday_to_monday,
|
253
|
+
)
|
254
|
+
|
255
|
+
JapanRespectForTheAgedDay1966To1972 = Holiday(
|
256
|
+
name="Respect for the Aged Day",
|
257
|
+
month=9,
|
258
|
+
day=15,
|
259
|
+
start_date=Timestamp(1966, 1, 1),
|
260
|
+
end_date=Timestamp(1972, 12, 31)
|
261
|
+
)
|
262
|
+
|
263
|
+
JapanRespectForTheAgedDay1973To2002 = Holiday(
|
264
|
+
name="Respect for the Aged Day",
|
265
|
+
month=9,
|
266
|
+
day=15,
|
267
|
+
start_date=Timestamp(1973, 1, 1),
|
268
|
+
end_date=Timestamp(2002, 12, 31),
|
269
|
+
observance=sunday_to_monday,
|
270
|
+
)
|
271
|
+
|
272
|
+
JapanRespectForTheAgedDay = Holiday(
|
273
|
+
name="Respect for the Aged Day",
|
274
|
+
month=9,
|
275
|
+
day=1,
|
276
|
+
start_date=Timestamp(2003, 1, 1),
|
277
|
+
offset=DateOffset(weekday=MO(3)),
|
278
|
+
)
|
279
|
+
|
280
|
+
# Citizen's Day added in some years between Respect for Aged and Autumnal Equinox
|
281
|
+
|
282
|
+
JapanAutumnalEquinox = Holiday(
|
283
|
+
name="Autumnal Equinox",
|
284
|
+
month=9,
|
285
|
+
day=22,
|
286
|
+
observance=autumnal_equinox,
|
287
|
+
)
|
288
|
+
|
289
|
+
JapanHealthAndSportsDay1966To1972 = Holiday(
|
290
|
+
name="Health and Sports Day",
|
291
|
+
month=10,
|
292
|
+
day=10,
|
293
|
+
start_date=Timestamp(1966, 1, 1),
|
294
|
+
end_date=Timestamp(1972, 12, 31),
|
295
|
+
)
|
296
|
+
|
297
|
+
JapanHealthAndSportsDay1973To1999 = Holiday(
|
298
|
+
name="Health and Sports Day",
|
299
|
+
month=10,
|
300
|
+
day=10,
|
301
|
+
start_date=Timestamp(1973, 1, 1),
|
302
|
+
end_date=Timestamp(1999, 12, 31),
|
303
|
+
observance=sunday_to_monday,
|
304
|
+
)
|
305
|
+
|
306
|
+
JapanHealthAndSportsDay2000To2019 = Holiday(
|
307
|
+
name="Health and Sports Day",
|
308
|
+
month=10,
|
309
|
+
day=1,
|
310
|
+
start_date=Timestamp(2000, 1, 1),
|
311
|
+
end_date=Timestamp(2019, 12, 31),
|
312
|
+
offset=DateOffset(weekday=MO(2)),
|
313
|
+
)
|
314
|
+
|
315
|
+
JapanSportsDay2020 = Holiday(
|
316
|
+
name="Sports Day", # shift for Olympics
|
317
|
+
year=2020,
|
318
|
+
month=7,
|
319
|
+
day=24,
|
320
|
+
)
|
321
|
+
|
322
|
+
JapanSportsDay2021 = Holiday(
|
323
|
+
name="Sports Day", # shift for Olympics (Olympics and Paralympics postponed until 2021 due to the COVID-19 pandemic)
|
324
|
+
year=2021,
|
325
|
+
month=7,
|
326
|
+
day=23,
|
327
|
+
)
|
328
|
+
|
329
|
+
JapanSportsDay = Holiday(
|
330
|
+
name="Sports Day",
|
331
|
+
month=10,
|
332
|
+
day=1,
|
333
|
+
start_date=Timestamp(2022, 1, 1),
|
334
|
+
offset=DateOffset(weekday=MO(2)),
|
335
|
+
)
|
336
|
+
|
337
|
+
JapanCultureDayUntil1972 = Holiday(
|
338
|
+
name="Culture Day", # prior to 1948 Emperor Meiji's Birthday
|
339
|
+
month=11,
|
340
|
+
day=3,
|
341
|
+
start_date=Timestamp(1948, 1, 1),
|
342
|
+
end_date=Timestamp(1972, 12, 31),
|
343
|
+
)
|
344
|
+
|
345
|
+
JapanCultureDay = Holiday(
|
346
|
+
name="Culture Day",
|
347
|
+
month=11,
|
348
|
+
day=3,
|
349
|
+
start_date=Timestamp(1973, 1, 1),
|
350
|
+
observance=sunday_to_monday,
|
351
|
+
)
|
352
|
+
|
353
|
+
JapanLaborThanksgivingDayUntil1972 = Holiday(
|
354
|
+
name="Labor Thanksgiving Day", # prior to 1948 harvest festival Niiname-sai
|
355
|
+
month=11,
|
356
|
+
day=23,
|
357
|
+
end_date=Timestamp(1972, 12, 31),
|
358
|
+
)
|
359
|
+
|
360
|
+
JapanLaborThanksgivingDay = Holiday(
|
361
|
+
name="Labor Thanksgiving Day",
|
362
|
+
month=11,
|
363
|
+
day=23,
|
364
|
+
start_date=Timestamp(1973, 1, 1),
|
365
|
+
observance=sunday_to_monday,
|
366
|
+
)
|
367
|
+
|
368
|
+
JapanEmperorAkahitosBirthday = Holiday(
|
369
|
+
name="Emperor Akahito's Birthday",
|
370
|
+
month=12,
|
371
|
+
day=23,
|
372
|
+
start_date=Timestamp(1990, 1, 1),
|
373
|
+
end_date=Timestamp(2018, 12, 31),
|
374
|
+
observance=sunday_to_monday,
|
375
|
+
)
|
376
|
+
|
377
|
+
JapanDecember29Until1988 = Holiday(
|
378
|
+
name="Closed Decenber 29",
|
379
|
+
month=12,
|
380
|
+
day=29,
|
381
|
+
end_date=Timestamp(1988, 12, 31),
|
382
|
+
)
|
383
|
+
|
384
|
+
JapanDecember30Until1988 = Holiday(
|
385
|
+
name="Closed December 30",
|
386
|
+
month=12,
|
387
|
+
day=30,
|
388
|
+
end_date=Timestamp(1988, 12, 31),
|
389
|
+
)
|
390
|
+
|
391
|
+
JapanBeforeNewYearsDay = Holiday(
|
392
|
+
name="Before New Year's Day", # prior to 1948 harvest festival Niname-sai
|
393
|
+
month=12,
|
394
|
+
day=31,
|
395
|
+
observance=sunday_to_monday,
|
396
|
+
)
|
@@ -0,0 +1,147 @@
|
|
1
|
+
"""
|
2
|
+
Equinox Day is a public holiday in Japan that usually occurs:
|
3
|
+
(in the Spring) on March 20 or 21,
|
4
|
+
(in the Autumn) on September 22 or 23,
|
5
|
+
the date of the equinox in Japan Standard Time.
|
6
|
+
Due to the necessity of recent astronomical measurements,
|
7
|
+
the date of the holiday is not officially declared until February of the previous year
|
8
|
+
|
9
|
+
We can't easily compute the equinox for a given year, so we pre-compute a list of those
|
10
|
+
from the Tokyo exchange inauguration through 2099,
|
11
|
+
using pyephem (http://rhodesmill.org/pyephem/quick.html#equinoxes-solstices).
|
12
|
+
For a double check, see: https://aa.usno.navy.mil/data/docs/EarthSeasons.php
|
13
|
+
"""
|
14
|
+
import pandas as pd
|
15
|
+
from pandas.tseries.holiday import sunday_to_monday
|
16
|
+
|
17
|
+
vernal_year_to_march_mapping = {
|
18
|
+
1875: 21, 1876: 20, 1877: 20, 1878: 21, 1879: 21,
|
19
|
+
1880: 20, 1881: 20, 1882: 21, 1883: 21, 1884: 20,
|
20
|
+
1885: 20, 1886: 21, 1887: 21, 1888: 20, 1889: 20,
|
21
|
+
1890: 21, 1891: 21, 1892: 20, 1893: 20, 1894: 20,
|
22
|
+
1895: 21, 1896: 20, 1897: 20, 1898: 20, 1899: 21,
|
23
|
+
|
24
|
+
1900: 21, 1901: 21, 1902: 21, 1903: 22, 1904: 21,
|
25
|
+
1905: 21, 1906: 21, 1907: 22, 1908: 21, 1909: 21,
|
26
|
+
1910: 21, 1911: 22, 1912: 21, 1913: 21, 1914: 21,
|
27
|
+
1915: 22, 1916: 21, 1917: 21, 1918: 21, 1919: 22,
|
28
|
+
1920: 21, 1921: 21, 1922: 21, 1923: 22, 1924: 21,
|
29
|
+
1925: 21, 1926: 21, 1927: 21, 1928: 21, 1929: 21,
|
30
|
+
1930: 21, 1931: 21, 1932: 21, 1933: 21, 1934: 21,
|
31
|
+
1935: 21, 1936: 21, 1937: 21, 1938: 21, 1939: 21,
|
32
|
+
1940: 21, 1941: 21, 1942: 21, 1943: 21, 1944: 21,
|
33
|
+
1945: 21, 1946: 21, 1947: 21, 1948: 21, 1949: 21,
|
34
|
+
1950: 21, 1951: 21, 1952: 21, 1953: 21, 1954: 21,
|
35
|
+
1955: 21, 1956: 21, 1957: 21, 1958: 21, 1959: 21,
|
36
|
+
1960: 20, 1961: 21, 1962: 21, 1963: 21, 1964: 20,
|
37
|
+
1965: 21, 1966: 21, 1967: 21, 1968: 20, 1969: 21,
|
38
|
+
1970: 21, 1971: 21, 1972: 20, 1973: 21, 1974: 21,
|
39
|
+
1975: 21, 1976: 20, 1977: 21, 1978: 21, 1979: 21,
|
40
|
+
1980: 20, 1981: 21, 1982: 21, 1983: 21, 1984: 20,
|
41
|
+
1985: 21, 1986: 21, 1987: 21, 1988: 20, 1989: 21,
|
42
|
+
1990: 21, 1991: 21, 1992: 20, 1993: 20, 1994: 21,
|
43
|
+
1995: 21, 1996: 20, 1997: 20, 1998: 21, 1999: 21,
|
44
|
+
|
45
|
+
2000: 20, 2001: 20, 2002: 21, 2003: 21, 2004: 20,
|
46
|
+
2005: 20, 2006: 21, 2007: 21, 2008: 20, 2009: 20,
|
47
|
+
2010: 21, 2011: 21, 2012: 20, 2013: 20, 2014: 21,
|
48
|
+
2015: 21, 2016: 20, 2017: 20, 2018: 21, 2019: 21,
|
49
|
+
2020: 20, 2021: 20, 2022: 21, 2023: 21, 2024: 20,
|
50
|
+
2025: 20, 2026: 20, 2027: 21, 2028: 20, 2029: 20,
|
51
|
+
2030: 20, 2031: 21, 2032: 20, 2033: 20, 2034: 20,
|
52
|
+
2035: 21, 2036: 20, 2037: 20, 2038: 20, 2039: 21,
|
53
|
+
2040: 20, 2041: 20, 2042: 20, 2043: 21, 2044: 20,
|
54
|
+
2045: 20, 2046: 20, 2047: 21, 2048: 20, 2049: 20,
|
55
|
+
2050: 20, 2051: 21, 2052: 20, 2053: 20, 2054: 20,
|
56
|
+
2055: 21, 2056: 20, 2057: 20, 2058: 20, 2059: 20,
|
57
|
+
2060: 20, 2061: 20, 2062: 20, 2063: 20, 2064: 20,
|
58
|
+
2065: 20, 2066: 20, 2067: 20, 2068: 20, 2069: 20,
|
59
|
+
2070: 20, 2071: 20, 2072: 20, 2073: 20, 2074: 20,
|
60
|
+
2075: 20, 2076: 20, 2077: 20, 2078: 20, 2079: 20,
|
61
|
+
2080: 20, 2081: 20, 2082: 20, 2083: 20, 2084: 20,
|
62
|
+
2085: 20, 2086: 20, 2087: 20, 2088: 20, 2089: 20,
|
63
|
+
2090: 20, 2091: 20, 2092: 19, 2093: 20, 2094: 20,
|
64
|
+
2095: 20, 2096: 19, 2097: 20, 2098: 20, 2099: 20,
|
65
|
+
}
|
66
|
+
|
67
|
+
autumnal_year_to_september_mapping = {
|
68
|
+
1875: 23, 1876: 23, 1877: 23, 1878: 23, 1879: 23,
|
69
|
+
1880: 23, 1881: 23, 1882: 23, 1883: 23, 1884: 23,
|
70
|
+
1885: 23, 1886: 23, 1887: 23, 1888: 22, 1889: 23,
|
71
|
+
1890: 23, 1891: 23, 1892: 22, 1893: 23, 1894: 23,
|
72
|
+
1895: 23, 1896: 22, 1897: 23, 1898: 23, 1899: 23,
|
73
|
+
|
74
|
+
1900: 23, 1901: 24, 1902: 24, 1903: 24, 1904: 23,
|
75
|
+
1905: 24, 1906: 24, 1907: 24, 1908: 23, 1909: 24,
|
76
|
+
1910: 24, 1911: 24, 1912: 23, 1913: 24, 1914: 24,
|
77
|
+
1915: 24, 1916: 23, 1917: 24, 1918: 24, 1919: 24,
|
78
|
+
1920: 23, 1921: 23, 1922: 24, 1923: 24, 1924: 23,
|
79
|
+
1925: 23, 1926: 24, 1927: 24, 1928: 23, 1929: 23,
|
80
|
+
1930: 24, 1931: 24, 1932: 23, 1933: 23, 1934: 24,
|
81
|
+
1935: 24, 1936: 23, 1937: 23, 1938: 24, 1939: 24,
|
82
|
+
1940: 23, 1941: 23, 1942: 24, 1943: 24, 1944: 23,
|
83
|
+
1945: 23, 1946: 24, 1947: 24, 1948: 23, 1949: 23,
|
84
|
+
1950: 23, 1951: 24, 1952: 23, 1953: 23, 1954: 23,
|
85
|
+
1955: 24, 1956: 23, 1957: 23, 1958: 23, 1959: 24,
|
86
|
+
1960: 23, 1961: 23, 1962: 23, 1963: 24, 1964: 23,
|
87
|
+
1965: 23, 1966: 23, 1967: 24, 1968: 23, 1969: 23,
|
88
|
+
1970: 23, 1971: 24, 1972: 23, 1973: 23, 1974: 23,
|
89
|
+
1975: 24, 1976: 23, 1977: 23, 1978: 23, 1979: 24,
|
90
|
+
1980: 23, 1981: 23, 1982: 23, 1983: 23, 1984: 23,
|
91
|
+
1985: 23, 1986: 23, 1987: 23, 1988: 23, 1989: 23,
|
92
|
+
1990: 23, 1991: 23, 1992: 23, 1993: 23, 1994: 23,
|
93
|
+
1995: 23, 1996: 23, 1997: 23, 1998: 23, 1999: 23,
|
94
|
+
|
95
|
+
2000: 23, 2001: 23, 2002: 23, 2003: 23, 2004: 23,
|
96
|
+
2005: 23, 2006: 23, 2007: 23, 2008: 23, 2009: 23,
|
97
|
+
2010: 23, 2011: 23, 2012: 22, 2013: 23, 2014: 23,
|
98
|
+
2015: 23, 2016: 22, 2017: 23, 2018: 23, 2019: 23,
|
99
|
+
2020: 22, 2021: 23, 2022: 23, 2023: 23, 2024: 22,
|
100
|
+
2025: 23, 2026: 23, 2027: 23, 2028: 22, 2029: 23,
|
101
|
+
2030: 23, 2031: 23, 2032: 22, 2033: 23, 2034: 23,
|
102
|
+
2035: 23, 2036: 22, 2037: 23, 2038: 23, 2039: 23,
|
103
|
+
2040: 22, 2041: 23, 2042: 23, 2043: 23, 2044: 22,
|
104
|
+
2045: 22, 2046: 23, 2047: 23, 2048: 22, 2049: 22,
|
105
|
+
2050: 23, 2051: 23, 2052: 22, 2053: 22, 2054: 23,
|
106
|
+
2055: 23, 2056: 22, 2057: 22, 2058: 23, 2059: 23,
|
107
|
+
2060: 22, 2061: 22, 2062: 23, 2063: 23, 2064: 22,
|
108
|
+
2065: 22, 2066: 23, 2067: 23, 2068: 22, 2069: 22,
|
109
|
+
2070: 23, 2071: 23, 2072: 22, 2073: 22, 2074: 23,
|
110
|
+
2075: 23, 2076: 22, 2077: 22, 2078: 22, 2079: 23,
|
111
|
+
2080: 22, 2081: 22, 2082: 22, 2083: 23, 2084: 22,
|
112
|
+
2085: 22, 2086: 22, 2087: 23, 2088: 22, 2089: 22,
|
113
|
+
2090: 22, 2091: 23, 2092: 22, 2093: 22, 2094: 22,
|
114
|
+
2095: 23, 2096: 22, 2097: 22, 2098: 22, 2099: 23,
|
115
|
+
}
|
116
|
+
|
117
|
+
|
118
|
+
def vernal_equinox_for_year(year):
|
119
|
+
day = vernal_year_to_march_mapping.get(year, 20)
|
120
|
+
return pd.Timestamp(year, 3, day)
|
121
|
+
|
122
|
+
|
123
|
+
def vernal_equinox(dt):
|
124
|
+
year = dt.year
|
125
|
+
equinox = vernal_equinox_for_year(year)
|
126
|
+
return sunday_to_monday(equinox) if year >= 1973 else equinox
|
127
|
+
|
128
|
+
|
129
|
+
def autumnal_equinox_for_year(year):
|
130
|
+
day = autumnal_year_to_september_mapping.get(year, 23)
|
131
|
+
return pd.Timestamp(year, 9, day)
|
132
|
+
|
133
|
+
|
134
|
+
def autumnal_equinox(dt):
|
135
|
+
year = dt.year
|
136
|
+
equinox = autumnal_equinox_for_year(year)
|
137
|
+
return sunday_to_monday(equinox) if year >= 1973 else equinox
|
138
|
+
|
139
|
+
|
140
|
+
def autumnal_citizen_dates(start=2003, end=2099):
|
141
|
+
dates = []
|
142
|
+
for year in range(start, end):
|
143
|
+
respect_for_aged = pd.Timestamp(year, 9, 1) + pd.offsets.WeekOfMonth(week=2, weekday=0)
|
144
|
+
equinox = autumnal_equinox_for_year(year)
|
145
|
+
if (equinox - respect_for_aged).days == 2:
|
146
|
+
dates.append(respect_for_aged + pd.offsets.Day())
|
147
|
+
return dates
|