pandas-market-calendars 4.1.3__py3-none-any.whl → 4.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pandas_market_calendars-4.1.3.dist-info → pandas_market_calendars-4.2.0.dist-info}/METADATA +200 -187
- pandas_market_calendars-4.2.0.dist-info/NOTICE +206 -0
- pandas_market_calendars-4.2.0.dist-info/RECORD +6 -0
- {pandas_market_calendars-4.1.3.dist-info → pandas_market_calendars-4.2.0.dist-info}/WHEEL +1 -1
- pandas_market_calendars/__init__.py +0 -37
- pandas_market_calendars/calendar_registry.py +0 -47
- pandas_market_calendars/calendar_utils.py +0 -225
- pandas_market_calendars/class_registry.py +0 -111
- pandas_market_calendars/exchange_calendar_asx.py +0 -63
- pandas_market_calendars/exchange_calendar_bmf.py +0 -227
- pandas_market_calendars/exchange_calendar_bse.py +0 -409
- pandas_market_calendars/exchange_calendar_cboe.py +0 -115
- pandas_market_calendars/exchange_calendar_cme.py +0 -240
- pandas_market_calendars/exchange_calendar_cme_globex_agriculture.py +0 -109
- pandas_market_calendars/exchange_calendar_cme_globex_base.py +0 -106
- pandas_market_calendars/exchange_calendar_cme_globex_energy_and_metals.py +0 -146
- pandas_market_calendars/exchange_calendar_cme_globex_equities.py +0 -104
- pandas_market_calendars/exchange_calendar_cme_globex_fixed_income.py +0 -114
- pandas_market_calendars/exchange_calendar_cme_globex_fx.py +0 -78
- pandas_market_calendars/exchange_calendar_eurex.py +0 -119
- pandas_market_calendars/exchange_calendar_hkex.py +0 -408
- pandas_market_calendars/exchange_calendar_ice.py +0 -65
- pandas_market_calendars/exchange_calendar_iex.py +0 -98
- pandas_market_calendars/exchange_calendar_jpx.py +0 -98
- pandas_market_calendars/exchange_calendar_lse.py +0 -91
- pandas_market_calendars/exchange_calendar_nyse.py +0 -1127
- pandas_market_calendars/exchange_calendar_ose.py +0 -150
- pandas_market_calendars/exchange_calendar_sifma.py +0 -300
- pandas_market_calendars/exchange_calendar_six.py +0 -114
- pandas_market_calendars/exchange_calendar_sse.py +0 -290
- pandas_market_calendars/exchange_calendar_tase.py +0 -119
- pandas_market_calendars/exchange_calendar_tsx.py +0 -159
- pandas_market_calendars/exchange_calendars_mirror.py +0 -114
- pandas_market_calendars/holidays_cme.py +0 -341
- pandas_market_calendars/holidays_cme_globex.py +0 -169
- pandas_market_calendars/holidays_cn.py +0 -1436
- pandas_market_calendars/holidays_jp.py +0 -362
- pandas_market_calendars/holidays_nyse.py +0 -1474
- pandas_market_calendars/holidays_oz.py +0 -65
- pandas_market_calendars/holidays_sifma.py +0 -321
- pandas_market_calendars/holidays_uk.py +0 -177
- pandas_market_calendars/holidays_us.py +0 -364
- pandas_market_calendars/jpx_equinox.py +0 -147
- pandas_market_calendars/market_calendar.py +0 -770
- pandas_market_calendars-4.1.3.dist-info/RECORD +0 -45
- {pandas_market_calendars-4.1.3.dist-info → pandas_market_calendars-4.2.0.dist-info}/LICENSE +0 -0
- {pandas_market_calendars-4.1.3.dist-info → pandas_market_calendars-4.2.0.dist-info}/top_level.txt +0 -0
@@ -1,364 +0,0 @@
|
|
1
|
-
from dateutil.relativedelta import (MO, TH, TU, FR)
|
2
|
-
from pandas import (DateOffset, Timestamp, date_range)
|
3
|
-
from pandas.tseries.holiday import (Holiday, nearest_workday, sunday_to_monday)
|
4
|
-
from pandas.tseries.offsets import Day
|
5
|
-
|
6
|
-
from pandas_market_calendars.market_calendar import (FRIDAY, MONDAY, THURSDAY, TUESDAY, WEDNESDAY)
|
7
|
-
|
8
|
-
|
9
|
-
# These have the same definition, but are used in different places because the
|
10
|
-
# NYSE closed at 2:00 PM on Christmas Eve until 1993.
|
11
|
-
|
12
|
-
|
13
|
-
def july_5th_holiday_observance(datetime_index):
|
14
|
-
return datetime_index[datetime_index.year < 2013]
|
15
|
-
|
16
|
-
|
17
|
-
def following_tuesday_every_four_years_observance(dt):
|
18
|
-
return dt + DateOffset(years=(4 - (dt.year % 4)) % 4, weekday=TU(1))
|
19
|
-
|
20
|
-
|
21
|
-
ChristmasEveBefore1993 = Holiday(
|
22
|
-
'Christmas Eve',
|
23
|
-
month=12,
|
24
|
-
day=24,
|
25
|
-
end_date=Timestamp('1993-01-01'),
|
26
|
-
# When Christmas is a Saturday, the 24th is a full holiday.
|
27
|
-
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY),
|
28
|
-
)
|
29
|
-
ChristmasEveInOrAfter1993 = Holiday(
|
30
|
-
'Christmas Eve',
|
31
|
-
month=12,
|
32
|
-
day=24,
|
33
|
-
start_date=Timestamp('1993-01-01'),
|
34
|
-
# When Christmas is a Saturday, the 24th is a full holiday.
|
35
|
-
days_of_week=(MONDAY, TUESDAY, WEDNESDAY, THURSDAY),
|
36
|
-
)
|
37
|
-
USNewYearsDay = Holiday(
|
38
|
-
'New Years Day',
|
39
|
-
month=1,
|
40
|
-
day=1,
|
41
|
-
# When Jan 1 is a Sunday, US markets observe the subsequent Monday.
|
42
|
-
# When Jan 1 is a Saturday (as in 2005 and 2011), no holiday is observed.
|
43
|
-
observance=sunday_to_monday
|
44
|
-
)
|
45
|
-
USMartinLutherKingJrAfter1998 = Holiday(
|
46
|
-
'Dr. Martin Luther King Jr. Day',
|
47
|
-
month=1,
|
48
|
-
day=1,
|
49
|
-
# The US markets didn't observe MLK day as a holiday until 1998.
|
50
|
-
start_date=Timestamp('1998-01-01'),
|
51
|
-
offset=DateOffset(weekday=MO(3)),
|
52
|
-
)
|
53
|
-
USLincolnsBirthDayBefore1954 = Holiday(
|
54
|
-
'Lincoln''s Birthday',
|
55
|
-
month=2,
|
56
|
-
day=12,
|
57
|
-
start_date=Timestamp('1874-01-01'),
|
58
|
-
end_date=Timestamp('1953-12-31'),
|
59
|
-
observance=sunday_to_monday,
|
60
|
-
)
|
61
|
-
USWashingtonsBirthDayBefore1964 = Holiday(
|
62
|
-
'Washington''s Birthday',
|
63
|
-
month=2,
|
64
|
-
day=22,
|
65
|
-
start_date=Timestamp('1880-01-01'),
|
66
|
-
end_date=Timestamp('1963-12-31'),
|
67
|
-
observance=sunday_to_monday,
|
68
|
-
)
|
69
|
-
USWashingtonsBirthDay1964to1970 = Holiday(
|
70
|
-
'Washington''s Birthday',
|
71
|
-
month=2,
|
72
|
-
day=22,
|
73
|
-
start_date=Timestamp('1964-01-01'),
|
74
|
-
end_date=Timestamp('1970-12-31'),
|
75
|
-
observance=nearest_workday,
|
76
|
-
)
|
77
|
-
USPresidentsDay = Holiday('President''s Day',
|
78
|
-
start_date=Timestamp('1971-01-01'),
|
79
|
-
month=2, day=1,
|
80
|
-
offset=DateOffset(weekday=MO(3)))
|
81
|
-
# http://www.tradingtheodds.com/nyse-full-day-closings/
|
82
|
-
USThanksgivingDayBefore1939 = Holiday('Thanksgiving Before 1939',
|
83
|
-
start_date=Timestamp('1864-01-01'),
|
84
|
-
end_date=Timestamp('1938-12-31'),
|
85
|
-
month=11, day=30,
|
86
|
-
offset=DateOffset(weekday=TH(-1)))
|
87
|
-
# http://www.tradingtheodds.com/nyse-full-day-closings/
|
88
|
-
USThanksgivingDay1939to1941 = Holiday('Thanksgiving 1939 to 1941',
|
89
|
-
start_date=Timestamp('1939-01-01'),
|
90
|
-
end_date=Timestamp('1941-12-31'),
|
91
|
-
month=11, day=30,
|
92
|
-
offset=DateOffset(weekday=TH(-2)))
|
93
|
-
USThanksgivingDay = Holiday('Thanksgiving',
|
94
|
-
start_date=Timestamp('1942-01-01'),
|
95
|
-
month=11, day=1,
|
96
|
-
offset=DateOffset(weekday=TH(4)))
|
97
|
-
# http://www.tradingtheodds.com/nyse-full-day-closings/
|
98
|
-
USMemorialDayBefore1964 = Holiday(
|
99
|
-
'Memorial Day',
|
100
|
-
month=5,
|
101
|
-
day=30,
|
102
|
-
end_date=Timestamp('1963-12-31'),
|
103
|
-
observance=sunday_to_monday,
|
104
|
-
)
|
105
|
-
# http://www.tradingtheodds.com/nyse-full-day-closings/
|
106
|
-
USMemorialDay1964to1969 = Holiday(
|
107
|
-
'Memorial Day',
|
108
|
-
month=5,
|
109
|
-
day=30,
|
110
|
-
start_date=Timestamp('1964-01-01'),
|
111
|
-
end_date=Timestamp('1969-12-31'),
|
112
|
-
observance=nearest_workday,
|
113
|
-
)
|
114
|
-
USMemorialDay = Holiday(
|
115
|
-
# NOTE: The definition for Memorial Day is incorrect as of pandas 0.16.0.
|
116
|
-
# See https://github.com/pydata/pandas/issues/9760.
|
117
|
-
'Memorial Day',
|
118
|
-
month=5,
|
119
|
-
day=25,
|
120
|
-
start_date=Timestamp('1971-01-01'),
|
121
|
-
offset=DateOffset(weekday=MO(1)),
|
122
|
-
)
|
123
|
-
# http://www.tradingtheodds.com/nyse-full-day-closings/
|
124
|
-
USIndependenceDayBefore1954 = Holiday(
|
125
|
-
'July 4th',
|
126
|
-
month=7,
|
127
|
-
day=4,
|
128
|
-
end_date=Timestamp('1953-12-31'),
|
129
|
-
observance=sunday_to_monday,
|
130
|
-
)
|
131
|
-
USIndependenceDay = Holiday(
|
132
|
-
'July 4th',
|
133
|
-
month=7,
|
134
|
-
day=4,
|
135
|
-
start_date=Timestamp('1954-01-01'),
|
136
|
-
observance=nearest_workday,
|
137
|
-
)
|
138
|
-
# http://www.tradingtheodds.com/nyse-full-day-closings/
|
139
|
-
USElectionDay1848to1967 = Holiday(
|
140
|
-
'Election Day',
|
141
|
-
month=11,
|
142
|
-
day=2,
|
143
|
-
start_date=Timestamp('1848-1-1'),
|
144
|
-
end_date=Timestamp('1967-12-31'),
|
145
|
-
offset=DateOffset(weekday=TU(1)),
|
146
|
-
)
|
147
|
-
# http://www.tradingtheodds.com/nyse-full-day-closings/
|
148
|
-
USElectionDay1968to1980 = Holiday(
|
149
|
-
'Election Day',
|
150
|
-
month=11,
|
151
|
-
day=2,
|
152
|
-
start_date=Timestamp('1968-01-01'),
|
153
|
-
end_date=Timestamp('1980-12-31'),
|
154
|
-
observance=following_tuesday_every_four_years_observance
|
155
|
-
)
|
156
|
-
# http://www.tradingtheodds.com/nyse-full-day-closings/
|
157
|
-
USVeteransDay1934to1953 = Holiday(
|
158
|
-
'Veteran Day',
|
159
|
-
month=11,
|
160
|
-
day=11,
|
161
|
-
start_date=Timestamp('1934-1-1'),
|
162
|
-
end_date=Timestamp('1953-12-31'),
|
163
|
-
observance=sunday_to_monday,
|
164
|
-
)
|
165
|
-
# http://www.tradingtheodds.com/nyse-full-day-closings/
|
166
|
-
USColumbusDayBefore1954 = Holiday(
|
167
|
-
'Columbus Day',
|
168
|
-
month=10,
|
169
|
-
day=12,
|
170
|
-
end_date=Timestamp('1953-12-31'),
|
171
|
-
observance=sunday_to_monday,
|
172
|
-
)
|
173
|
-
ChristmasBefore1954 = Holiday(
|
174
|
-
'Christmas',
|
175
|
-
month=12,
|
176
|
-
day=25,
|
177
|
-
end_date=Timestamp('1953-12-31'),
|
178
|
-
observance=sunday_to_monday,
|
179
|
-
)
|
180
|
-
Christmas = Holiday(
|
181
|
-
'Christmas',
|
182
|
-
month=12,
|
183
|
-
day=25,
|
184
|
-
start_date=Timestamp('1954-01-01'),
|
185
|
-
observance=nearest_workday,
|
186
|
-
)
|
187
|
-
|
188
|
-
MonTuesThursBeforeIndependenceDay = Holiday(
|
189
|
-
# When July 4th is a Tuesday, Wednesday, or Friday, the previous day is a
|
190
|
-
# half day.
|
191
|
-
'Mondays, Tuesdays, and Thursdays Before Independence Day',
|
192
|
-
month=7,
|
193
|
-
day=3,
|
194
|
-
days_of_week=(MONDAY, TUESDAY, THURSDAY),
|
195
|
-
start_date=Timestamp("1995-01-01"),
|
196
|
-
)
|
197
|
-
FridayAfterIndependenceDayPre2013 = Holiday(
|
198
|
-
# When July 4th is a Thursday, the next day is a half day prior to 2013.
|
199
|
-
# Since 2013 the early close is on Wednesday and Friday is a full day
|
200
|
-
"Fridays after Independence Day prior to 2013",
|
201
|
-
month=7,
|
202
|
-
day=5,
|
203
|
-
days_of_week=(FRIDAY,),
|
204
|
-
observance=july_5th_holiday_observance,
|
205
|
-
start_date=Timestamp("1995-01-01"),
|
206
|
-
)
|
207
|
-
WednesdayBeforeIndependenceDayPost2013 = Holiday(
|
208
|
-
# When July 4th is a Thursday, the next day is a half day prior to 2013.
|
209
|
-
# Since 2013 the early close is on Wednesday and Friday is a full day
|
210
|
-
"Wednesdays Before Independence Day including and after 2013",
|
211
|
-
month=7,
|
212
|
-
day=3,
|
213
|
-
days_of_week=(WEDNESDAY,),
|
214
|
-
start_date=Timestamp("2013-01-01"),
|
215
|
-
)
|
216
|
-
USBlackFridayBefore1993 = Holiday(
|
217
|
-
'Black Friday',
|
218
|
-
month=11,
|
219
|
-
day=1,
|
220
|
-
# Black Friday was not observed until 1992.
|
221
|
-
start_date=Timestamp('1992-01-01'),
|
222
|
-
end_date=Timestamp('1993-01-01'),
|
223
|
-
offset=[DateOffset(weekday=TH(4)), Day(1)],
|
224
|
-
)
|
225
|
-
USBlackFridayInOrAfter1993 = Holiday(
|
226
|
-
'Black Friday',
|
227
|
-
month=11,
|
228
|
-
day=1,
|
229
|
-
start_date=Timestamp('1993-01-01'),
|
230
|
-
offset=[DateOffset(weekday=TH(4)), Day(1)],
|
231
|
-
)
|
232
|
-
BattleOfGettysburg = Holiday(
|
233
|
-
# All of the floor traders in Chicago were sent to PA
|
234
|
-
'Markets were closed during the battle of Gettysburg',
|
235
|
-
month=7,
|
236
|
-
day=(1, 2, 3),
|
237
|
-
start_date=Timestamp("1863-07-01"),
|
238
|
-
end_date=Timestamp("1863-07-03")
|
239
|
-
)
|
240
|
-
|
241
|
-
# http://www.tradingtheodds.com/nyse-full-day-closings/
|
242
|
-
November29BacklogRelief = [Timestamp('1929-11-01', tz='UTC'),
|
243
|
-
Timestamp('1929-11-29', tz='UTC')]
|
244
|
-
|
245
|
-
# https://en.wikipedia.org/wiki/March_1933#March_6,_1933_(Monday)
|
246
|
-
March33BankHoliday = [
|
247
|
-
Timestamp("1933-03-06", tz="UTC"),
|
248
|
-
Timestamp("1933-03-07", tz="UTC"),
|
249
|
-
Timestamp("1933-03-08", tz="UTC"),
|
250
|
-
Timestamp("1933-03-09", tz="UTC"),
|
251
|
-
Timestamp("1933-03-10", tz="UTC"),
|
252
|
-
Timestamp("1933-03-13", tz="UTC"),
|
253
|
-
Timestamp("1933-03-14", tz="UTC"),
|
254
|
-
]
|
255
|
-
|
256
|
-
# http://www.tradingtheodds.com/nyse-full-day-closings/
|
257
|
-
August45VictoryOverJapan = date_range('1945-08-15', '1945-08-16', tz='UTC')
|
258
|
-
|
259
|
-
# http://www.tradingtheodds.com/nyse-full-day-closings/
|
260
|
-
ChristmasEvesAdhoc = [Timestamp('1945-12-24', tz='UTC'),
|
261
|
-
Timestamp('1956-12-24', tz='UTC')]
|
262
|
-
|
263
|
-
# http://www.tradingtheodds.com/nyse-full-day-closings/
|
264
|
-
DayAfterChristmasAdhoc = [Timestamp('1958-12-26', tz='UTC')]
|
265
|
-
|
266
|
-
# http://www.tradingtheodds.com/nyse-full-day-closings/
|
267
|
-
DayBeforeDecorationAdhoc = [Timestamp('1961-05-29', tz='UTC')]
|
268
|
-
|
269
|
-
# http://www.tradingtheodds.com/nyse-full-day-closings/
|
270
|
-
LincolnsBirthDayAdhoc = [Timestamp('1968-02-12', tz='UTC')]
|
271
|
-
|
272
|
-
# http://www.tradingtheodds.com/nyse-full-day-closings/
|
273
|
-
PaperworkCrisis68 = [Timestamp('1968-06-12', tz='UTC'),
|
274
|
-
Timestamp('1968-06-19', tz='UTC'),
|
275
|
-
Timestamp('1968-06-26', tz='UTC'),
|
276
|
-
Timestamp('1968-07-10', tz='UTC'),
|
277
|
-
Timestamp('1968-07-17', tz='UTC'),
|
278
|
-
Timestamp('1968-07-24', tz='UTC'),
|
279
|
-
Timestamp('1968-07-31', tz='UTC'),
|
280
|
-
Timestamp('1968-08-07', tz='UTC'),
|
281
|
-
Timestamp('1968-08-14', tz='UTC'),
|
282
|
-
Timestamp('1968-08-21', tz='UTC'),
|
283
|
-
Timestamp('1968-08-28', tz='UTC'),
|
284
|
-
Timestamp('1968-09-11', tz='UTC'),
|
285
|
-
Timestamp('1968-09-18', tz='UTC'),
|
286
|
-
Timestamp('1968-09-25', tz='UTC'),
|
287
|
-
Timestamp('1968-10-02', tz='UTC'),
|
288
|
-
Timestamp('1968-10-09', tz='UTC'),
|
289
|
-
Timestamp('1968-10-16', tz='UTC'),
|
290
|
-
Timestamp('1968-10-23', tz='UTC'),
|
291
|
-
Timestamp('1968-10-30', tz='UTC'),
|
292
|
-
Timestamp('1968-11-11', tz='UTC'),
|
293
|
-
Timestamp('1968-11-20', tz='UTC'),
|
294
|
-
Timestamp('1968-12-04', tz='UTC'),
|
295
|
-
Timestamp('1968-12-11', tz='UTC'),
|
296
|
-
Timestamp('1968-12-18', tz='UTC'),
|
297
|
-
Timestamp('1968-12-25', tz='UTC')]
|
298
|
-
|
299
|
-
# http://www.tradingtheodds.com/nyse-full-day-closings/
|
300
|
-
DayAfterIndependenceDayAdhoc = [Timestamp('1968-07-05', tz='UTC')]
|
301
|
-
|
302
|
-
# http://www.tradingtheodds.com/nyse-full-day-closings/
|
303
|
-
WeatherSnowClosing = [Timestamp('1969-02-10', tz='UTC')]
|
304
|
-
|
305
|
-
# http://www.tradingtheodds.com/nyse-full-day-closings/
|
306
|
-
FirstLunarLandingClosing = [Timestamp('1969-07-21', tz='UTC')]
|
307
|
-
|
308
|
-
# http://www.tradingtheodds.com/nyse-full-day-closings/
|
309
|
-
NewYorkCityBlackout77 = [Timestamp('1977-07-14', tz='UTC')]
|
310
|
-
|
311
|
-
# http://en.wikipedia.org/wiki/Aftermath_of_the_September_11_attacks
|
312
|
-
September11Closings = [
|
313
|
-
Timestamp("2001-09-11", tz='UTC'),
|
314
|
-
Timestamp("2001-09-12", tz='UTC'),
|
315
|
-
Timestamp("2001-09-13", tz='UTC'),
|
316
|
-
Timestamp("2001-09-14", tz='UTC'),
|
317
|
-
]
|
318
|
-
|
319
|
-
# http://en.wikipedia.org/wiki/Hurricane_Gloria
|
320
|
-
HurricaneGloriaClosings = date_range(
|
321
|
-
'1985-09-27',
|
322
|
-
'1985-09-27',
|
323
|
-
tz='UTC'
|
324
|
-
)
|
325
|
-
|
326
|
-
# http://en.wikipedia.org/wiki/Hurricane_sandy
|
327
|
-
HurricaneSandyClosings = date_range(
|
328
|
-
'2012-10-29',
|
329
|
-
'2012-10-30',
|
330
|
-
tz='UTC'
|
331
|
-
)
|
332
|
-
|
333
|
-
# National Days of Mourning
|
334
|
-
# - President John F. Kennedy - November 25, 1963
|
335
|
-
# - Martin Luther King - April 9, 1968
|
336
|
-
# - President Dwight D. Eisenhower - March 31, 1969
|
337
|
-
# - President Harry S. Truman - December 28, 1972
|
338
|
-
# - President Lyndon B. Johnson - January 25, 1973
|
339
|
-
# - President Richard Nixon - April 27, 1994
|
340
|
-
# - President Ronald W. Reagan - June 11, 2004
|
341
|
-
# - President Gerald R. Ford - Jan 2, 2007
|
342
|
-
# - President George H.W. Bush - Dec 5, 2018
|
343
|
-
USNationalDaysofMourning = [
|
344
|
-
Timestamp('1963-11-25', tz='UTC'),
|
345
|
-
Timestamp('1968-04-09', tz='UTC'),
|
346
|
-
Timestamp('1969-03-31', tz='UTC'),
|
347
|
-
Timestamp('1972-12-28', tz='UTC'),
|
348
|
-
Timestamp('1973-01-25', tz='UTC'),
|
349
|
-
Timestamp('1994-04-27', tz='UTC'),
|
350
|
-
Timestamp('2004-06-11', tz='UTC'),
|
351
|
-
Timestamp('2007-01-02', tz='UTC'),
|
352
|
-
Timestamp('2018-12-05', tz='UTC'),
|
353
|
-
]
|
354
|
-
|
355
|
-
|
356
|
-
#######################################
|
357
|
-
# US Juneteenth (June 19th)
|
358
|
-
#######################################
|
359
|
-
USJuneteenthAfter2022 = Holiday(
|
360
|
-
'Juneteenth Starting at 2022',
|
361
|
-
start_date=Timestamp('2022-06-19'),
|
362
|
-
month=6, day=19,
|
363
|
-
observance=nearest_workday,
|
364
|
-
)
|
@@ -1,147 +0,0 @@
|
|
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
|