Python pandas.tseries.offsets.CustomBusinessDay() Examples
The following are 12
code examples of pandas.tseries.offsets.CustomBusinessDay().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pandas.tseries.offsets
, or try the search function
.
Example #1
Source File: bitmex_calendar.py From zipline-bitmex with GNU General Public License v3.0 | 6 votes |
def day(self): return CustomBusinessDay(weekmask='Mon Tue Wed Thu Fri Sat Sun')
Example #2
Source File: __init__.py From trendln with MIT License | 6 votes |
def datefmt(xdate, cal=None): from pandas.tseries.holiday import AbstractHolidayCalendar, Holiday, nearest_workday, \ USMartinLutherKingJr, USPresidentsDay, GoodFriday, USMemorialDay, \ USLaborDay, USThanksgivingDay from pandas.tseries.offsets import CustomBusinessDay class USTradingCalendar(AbstractHolidayCalendar): rules = [ Holiday('NewYearsDay', month=1, day=1, observance=nearest_workday), USMartinLutherKingJr, USPresidentsDay, GoodFriday, USMemorialDay, Holiday('USIndependenceDay', month=7, day=4, observance=nearest_workday), USLaborDay, USThanksgivingDay, Holiday('Christmas', month=12, day=25, observance=nearest_workday) ] if cal == None: cal = USTradingCalendar() def mydate(x,pos): #print((x,pos)) val = int(x + 0.5) if val < 0: return (xdate[0].to_pydatetime() - CustomBusinessDay(-val, calendar=cal)).strftime('%Y-%m-%d') elif val >= len(xdate): return (xdate[-1].to_pydatetime() + CustomBusinessDay(val - len(xdate) + 1, calendar=cal)).strftime('%Y-%m-%d') else: return xdate[val].strftime('%Y-%m-%d') return mydate
Example #3
Source File: test_series.py From recruit with Apache License 2.0 | 5 votes |
def test_custom_business_day_freq(self): # GH7222 from pandas.tseries.offsets import CustomBusinessDay s = Series(range(100, 121), index=pd.bdate_range( start='2014-05-01', end='2014-06-01', freq=CustomBusinessDay(holidays=['2014-05-26']))) _check_plot_works(s.plot)
Example #4
Source File: test_series.py From vnpy_crypto with MIT License | 5 votes |
def test_custom_business_day_freq(self): # GH7222 from pandas.tseries.offsets import CustomBusinessDay s = Series(range(100, 121), index=pd.bdate_range( start='2014-05-01', end='2014-06-01', freq=CustomBusinessDay(holidays=['2014-05-26']))) _check_plot_works(s.plot)
Example #5
Source File: test_series.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
def test_custom_business_day_freq(self): # GH7222 from pandas.tseries.offsets import CustomBusinessDay s = Series(range(100, 121), index=pd.bdate_range( start='2014-05-01', end='2014-06-01', freq=CustomBusinessDay(holidays=['2014-05-26']))) _check_plot_works(s.plot)
Example #6
Source File: trading_calendar.py From trading_calendars with Apache License 2.0 | 5 votes |
def day(self): return CustomBusinessDay( holidays=self.adhoc_holidays, calendar=self.regular_holidays, weekmask=self.weekmask, )
Example #7
Source File: trading_calendar.py From catalyst with Apache License 2.0 | 5 votes |
def day(self): return CustomBusinessDay( holidays=self.adhoc_holidays, calendar=self.regular_holidays, )
Example #8
Source File: measures.py From gs-quant with Apache License 2.0 | 5 votes |
def _get_custom_bd(exchange): from pandas.tseries.offsets import CustomBusinessDay calendar = GsCalendar.get(exchange).business_day_calendar() return CustomBusinessDay(calendar=calendar)
Example #9
Source File: market_calendar.py From pandas_market_calendars with MIT License | 5 votes |
def holidays(self): """ Returns the complete CustomBusinessDay object of holidays that can be used in any Pandas function that take that input. :return: CustomBusinessDay object of holidays """ return CustomBusinessDay( holidays=self.adhoc_holidays, calendar=self.regular_holidays, weekmask=self.weekmask, )
Example #10
Source File: test_series.py From elasticintel with GNU General Public License v3.0 | 5 votes |
def test_custom_business_day_freq(self): # GH7222 from pandas.tseries.offsets import CustomBusinessDay s = Series(range(100, 121), index=pd.bdate_range( start='2014-05-01', end='2014-06-01', freq=CustomBusinessDay(holidays=['2014-05-26']))) _check_plot_works(s.plot)
Example #11
Source File: test_series.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_custom_business_day_freq(self): # GH7222 from pandas.tseries.offsets import CustomBusinessDay s = Series(range(100, 121), index=pd.bdate_range( start='2014-05-01', end='2014-06-01', freq=CustomBusinessDay(holidays=['2014-05-26']))) _check_plot_works(s.plot)
Example #12
Source File: test_series.py From coffeegrindsize with MIT License | 4 votes |
def test_custom_business_day_freq(self): # GH7222 from pandas.tseries.offsets import CustomBusinessDay s = Series(range(100, 121), index=pd.bdate_range( start='2014-05-01', end='2014-06-01', freq=CustomBusinessDay(holidays=['2014-05-26']))) _check_plot_works(s.plot)