Holidays
In [1]:
Out[1]:
Open
High
Low
Close
Adj Close
Volume
0
190.679993
191.960007
189.559998
191.610001
188.737030
15989400
1
192.449997
193.660004
192.050003
193.000000
190.106216
18697900
2
193.059998
194.850006
192.429993
194.820007
191.898926
16709900
3
194.610001
195.960007
193.610001
194.210007
191.298080
19076000
4
194.990005
195.190002
190.100006
190.979996
188.116501
24024000
Using 'B' frequency is not going to help because 4th July was holiday and 'B' is not taking that into account. It only accounts for weekends
Generate US holidays calendar frequency
In [2]:
Out[2]:
In [5]:
Out[5]:
Open
High
Low
Close
Adj Close
Volume
2018-07-23
190.679993
191.960007
189.559998
191.610001
188.737030
15989400
2018-07-24
192.449997
193.660004
192.050003
193.000000
190.106216
18697900
2018-07-25
193.059998
194.850006
192.429993
194.820007
191.898926
16709900
2018-07-26
194.610001
195.960007
193.610001
194.210007
191.298080
19076000
2018-07-27
194.990005
195.190002
190.100006
190.979996
188.116501
24024000
You can define your own calendar using AbstractHolidayCalendar as shown below. USFederalHolidayCalendar is the only calendar available in pandas library and it serves as an example for those who want to write their own custom calendars. Here is the link for USFederalHolidayCalendar implementation https://github.com/pandas-dev/pandas/blob/master/pandas/tseries/holiday.py
In [12]:
Out[12]:
Weekend in egypt is Friday and Saturday. Sunday is just a normal weekday and you can handle this custom week schedule using CystomBysinessDay with weekmask as shown below
In [15]:
Out[15]:
You can also add holidays to this custom business day frequency¶
In [17]:
Out[17]:
Mathematical operations on date object using custom business day¶
In [18]:
Out[18]:
Out[19]:
Last updated