当前位置: 首页>>代码示例>>Python>>正文


Python easter.easter方法代码示例

本文整理汇总了Python中dateutil.easter.easter方法的典型用法代码示例。如果您正苦于以下问题:Python easter.easter方法的具体用法?Python easter.easter怎么用?Python easter.easter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dateutil.easter的用法示例。


在下文中一共展示了easter.easter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: apply

# 需要导入模块: from dateutil import easter [as 别名]
# 或者: from dateutil.easter import easter [as 别名]
def apply(self, other):
        current_easter = easter(other.year)
        current_easter = datetime(current_easter.year,
                                  current_easter.month, current_easter.day)
        current_easter = conversion.localize_pydatetime(current_easter,
                                                        other.tzinfo)

        n = self.n
        if n >= 0 and other < current_easter:
            n -= 1
        elif n < 0 and other > current_easter:
            n += 1
        # TODO: Why does this handle the 0 case the opposite of others?

        # NOTE: easter returns a datetime.date so we have to convert to type of
        # other
        new = easter(other.year + n)
        new = datetime(new.year, new.month, new.day, other.hour,
                       other.minute, other.second, other.microsecond)
        return new 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:22,代码来源:offsets.py

示例2: apply

# 需要导入模块: from dateutil import easter [as 别名]
# 或者: from dateutil.easter import easter [as 别名]
def apply(self, other):
        current_easter = easter(other.year)
        current_easter = datetime(current_easter.year,
                                  current_easter.month, current_easter.day)
        current_easter = tslib._localize_pydatetime(current_easter,
                                                    other.tzinfo)

        n = self.n
        if n >= 0 and other < current_easter:
            n -= 1
        elif n < 0 and other > current_easter:
            n += 1
        # TODO: Why does this handle the 0 case the opposite of others?

        # NOTE: easter returns a datetime.date so we have to convert to type of
        # other
        new = easter(other.year + n)
        new = datetime(new.year, new.month, new.day, other.hour,
                       other.minute, other.second, other.microsecond)
        return new 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:22,代码来源:offsets.py

示例3: _populate

# 需要导入模块: from dateutil import easter [as 别名]
# 或者: from dateutil.easter import easter [as 别名]
def _populate(self, year):
        self[date(year, JAN, 1)] = 'Nowy Rok'
        if year >= 2011:
            self[date(year, JAN, 6)] = 'Święto Trzech Króli'

        e = easter(year)
        self[e] = 'Niedziela Wielkanocna'
        self[e + rd(days=1)] = 'Poniedziałek Wielkanocny'

        if year >= 1950:
            self[date(year, MAY, 1)] = 'Święto Państwowe'
        if year >= 1919:
            self[date(year, MAY, 3)] = 'Święto Narodowe Trzeciego Maja'

        self[e + rd(days=49)] = 'Zielone Świątki'
        self[e + rd(days=60)] = 'Dzień Bożego Ciała'

        self[date(year, AUG, 15)] = 'Wniebowzięcie Najświętszej Marii Panny'

        self[date(year, NOV, 1)] = 'Uroczystość Wszystkich świętych'
        if (1937 <= year <= 1945) or year >= 1989:
            self[date(year, NOV, 11)] = 'Narodowe Święto Niepodległości'

        self[date(year, DEC, 25)] = 'Boże Narodzenie (pierwszy dzień)'
        self[date(year, DEC, 26)] = 'Boże Narodzenie (drugi dzień)' 
开发者ID:dr-prodigy,项目名称:python-holidays,代码行数:27,代码来源:poland.py

示例4: _populate

# 需要导入模块: from dateutil import easter [as 别名]
# 或者: from dateutil.easter import easter [as 别名]
def _populate(self, year):
        e = easter(year)

        self[date(year, JAN, 1)] = "Uudenvuodenpäivä"
        self[date(year, JAN, 6)] = "Loppiainen"
        self[e - rd(days=2)] = "Pitkäperjantai"
        self[e] = "Pääsiäispäivä"
        self[e + rd(days=1)] = "2. pääsiäispäivä"
        self[date(year, MAY, 1)] = "Vappu"
        self[e + rd(days=39)] = "Helatorstai"
        self[e + rd(days=49)] = "Helluntaipäivä"
        self[date(year, JUN, 20) + rd(weekday=SA)] = "Juhannuspäivä"
        self[date(year, OCT, 31) + rd(weekday=SA)] = "Pyhäinpäivä"
        self[date(year, DEC, 6)] = "Itsenäisyyspäivä"
        self[date(year, DEC, 25)] = "Joulupäivä"
        self[date(year, DEC, 26)] = "Tapaninpäivä"

        # Juhannusaatto (Midsummer Eve) and Jouluaatto (Christmas Eve) are not
        # official holidays, but are de facto.
        self[date(year, JUN, 19) + rd(weekday=FR)] = "Juhannusaatto"
        self[date(year, DEC, 24)] = "Jouluaatto" 
开发者ID:dr-prodigy,项目名称:python-holidays,代码行数:23,代码来源:finland.py

示例5: _populate

# 需要导入模块: from dateutil import easter [as 别名]
# 或者: from dateutil.easter import easter [as 别名]
def _populate(self, year):
        # public holidays
        self[date(year, JAN, 1)] = "Neujahr"
        self[date(year, JAN, 6)] = "Heilige Drei Könige"
        self[easter(year) + rd(weekday=MO)] = "Ostermontag"
        self[date(year, MAY, 1)] = "Staatsfeiertag"
        self[easter(year) + rd(days=39)] = "Christi Himmelfahrt"
        self[easter(year) + rd(days=50)] = "Pfingstmontag"
        self[easter(year) + rd(days=60)] = "Fronleichnam"
        self[date(year, AUG, 15)] = "Mariä Himmelfahrt"
        if 1919 <= year <= 1934:
            self[date(year, NOV, 12)] = "Nationalfeiertag"
        if year >= 1967:
            self[date(year, OCT, 26)] = "Nationalfeiertag"
        self[date(year, NOV, 1)] = "Allerheiligen"
        self[date(year, DEC, 8)] = "Mariä Empfängnis"
        self[date(year, DEC, 25)] = "Christtag"
        self[date(year, DEC, 26)] = "Stefanitag" 
开发者ID:dr-prodigy,项目名称:python-holidays,代码行数:20,代码来源:austria.py

示例6: _populate

# 需要导入模块: from dateutil import easter [as 别名]
# 或者: from dateutil.easter import easter [as 别名]
def _populate(self, year):
        # Public holidays
        self[date(year, JAN, 1)] = "Nýársdagur"
        self[easter(year) - rd(days=3)] = "Skírdagur"
        self[easter(year) + rd(weekday=FR(-1))] = "Föstudagurinn langi"
        self[easter(year)] = "Páskadagur"
        self[easter(year) + rd(days=1)] = "Annar í páskum"
        self[date(year, APR, 19) + rd(weekday=TH(+1))] = \
            "Sumardagurinn fyrsti"
        self[date(year, MAY, 1)] = "Verkalýðsdagurinn"
        self[easter(year) + rd(days=39)] = "Uppstigningardagur"
        self[easter(year) + rd(days=49)] = "Hvítasunnudagur"
        self[easter(year) + rd(days=50)] = "Annar í hvítasunnu"
        self[date(year, JUN, 17)] = "Þjóðhátíðardagurinn"
        # First Monday of August
        self[date(year, AUG, 1) + rd(weekday=MO(+1))] = \
            "Frídagur verslunarmanna"
        self[date(year, DEC, 24)] = "Aðfangadagur"
        self[date(year, DEC, 25)] = "Jóladagur"
        self[date(year, DEC, 26)] = "Annar í jólum"
        self[date(year, DEC, 31)] = "Gamlársdagur" 
开发者ID:dr-prodigy,项目名称:python-holidays,代码行数:23,代码来源:iceland.py

示例7: apply

# 需要导入模块: from dateutil import easter [as 别名]
# 或者: from dateutil.easter import easter [as 别名]
def apply(self, other):
        currentEaster = easter(other.year)
        currentEaster = datetime(
            currentEaster.year, currentEaster.month, currentEaster.day)
        currentEaster = tslib._localize_pydatetime(currentEaster, other.tzinfo)

        # NOTE: easter returns a datetime.date so we have to convert to type of
        # other
        if self.n >= 0:
            if other >= currentEaster:
                new = easter(other.year + self.n)
            else:
                new = easter(other.year + self.n - 1)
        else:
            if other > currentEaster:
                new = easter(other.year + self.n + 1)
            else:
                new = easter(other.year + self.n)

        new = datetime(new.year, new.month, new.day, other.hour,
                       other.minute, other.second, other.microsecond)
        return new 
开发者ID:nccgroup,项目名称:Splunking-Crime,代码行数:24,代码来源:offsets.py

示例8: onOffset

# 需要导入模块: from dateutil import easter [as 别名]
# 或者: from dateutil.easter import easter [as 别名]
def onOffset(self, dt):
        if self.normalize and not _is_normalized(dt):
            return False
        return date(dt.year, dt.month, dt.day) == easter(dt.year)

# ---------------------------------------------------------------------
# Ticks 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:9,代码来源:offsets.py

示例9: _populate

# 需要导入模块: from dateutil import easter [as 别名]
# 或者: from dateutil.easter import easter [as 别名]
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

        # International Women's Day
        name = "International Women's Day"
        self[date(year, 3, 8)] = name

        # Commemoration Day
        name = "Commemoration Day"
        self[easter(year, EASTER_ORTHODOX) + timedelta(days=9)] = 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

        # Independence Day
        name = "Independence Day"
        self[date(year, 7, 3)] = name

        # October Revolution Day
        name = "October Revolution Day"
        self[date(year, 11, 7)] = name

        # Dec. 25 Christmas Day
        name = "Christmas Day"
        self[date(year, 12, 25)] = name 
开发者ID:facebook,项目名称:prophet,代码行数:38,代码来源:hdays.py

示例10: orthodox_easter

# 需要导入模块: from dateutil import easter [as 别名]
# 或者: from dateutil.easter import easter [as 别名]
def orthodox_easter(start_date='1980', end_date='2021'):
    """
    ASEX observes Orthodox Easter, and has many holidays
    that are relative to Orthodox Easter.  This function gives a
    DatetimeIndex of Orthodox Easter dates from start_date to end_date
    """
    return pd.to_datetime([
        easter(year, method=EASTER_ORTHODOX)
        for year in range(int(start_date), int(end_date))
    ]).tz_localize(UTC) 
开发者ID:quantopian,项目名称:trading_calendars,代码行数:12,代码来源:exchange_calendar_asex.py

示例11: adhoc_holidays

# 需要导入模块: from dateutil import easter [as 别名]
# 或者: from dateutil.easter import easter [as 别名]
def adhoc_holidays(self):
        debt_crisis = pd.date_range('2015-06-29', '2015-07-31', freq='B')

        debt_crisis_holidays = [
            pd.Timestamp(str(date), tz=UTC) for date in debt_crisis
        ]

        misc_adhoc_holidays = [
            # In 2002, market closed for unknown reason
            pd.Timestamp('2002-05-07', tz=UTC),
            # In 2004, Assumption Day fell on a sunday, observed on a Friday
            pd.Timestamp('2004-08-13', tz=UTC),
            # In 2008, worker strikes closed the market for 2 days in March
            pd.Timestamp('2008-03-04', tz=UTC),
            pd.Timestamp('2008-03-05', tz=UTC),
            # In 2013, May Day strikes closed the market
            pd.Timestamp('2013-05-07', tz=UTC),
            # In 2014, New Year's Eve was observed as a holiday
            pd.Timestamp('2014-12-31', tz=UTC),
            # In 2016, Labour Day fell on a Sunday, observed on Tuesday
            pd.Timestamp('2016-05-03', tz=UTC),
        ]

        return list(chain(
            debt_crisis_holidays,
            misc_adhoc_holidays,
            # TODO: Investigate making orthodox easter adhocs actual holidays
            OrthodoxGoodFriday,
            OrthodoxEasterMonday,
            OrthodoxWhitMonday,
            OrthodoxAshMonday,
        )) 
开发者ID:quantopian,项目名称:trading_calendars,代码行数:34,代码来源:exchange_calendar_asex.py

示例12: _populate

# 需要导入模块: from dateutil import easter [as 别名]
# 或者: from dateutil.easter import easter [as 别名]
def _populate(self, year):

        eday = easter(year, method=EASTER_ORTHODOX)

        # New Years
        self[date(year, JAN, 1)] = "Πρωτοχρονιά [New Year's Day]"
        # Epiphany
        self[date(year, JAN, 6)] = "Θεοφάνεια [Epiphany]"

        # Clean Monday
        self[eday - rd(days=48)] = "Καθαρά Δευτέρα [Clean Monday]"

        # Independence Day
        self[date(year, MAR, 25)] = "Εικοστή Πέμπτη Μαρτίου [Independence Day]"

        # Easter Monday
        self[eday + rd(days=1)] = "Δευτέρα του Πάσχα [Easter Monday]"

        # Labour Day
        self[date(year, MAY, 1)] = "Εργατική Πρωτομαγιά [Labour day]"

        # Monday of the Holy Spirit
        self[eday + rd(days=50)] = \
            "Δευτέρα του Αγίου Πνεύματος [Monday of the Holy Spirit]"

        # Assumption of Mary
        self[date(year, AUG, 15)] = "Κοίμηση της Θεοτόκου [Assumption of Mary]"

        # Ochi Day
        self[date(year, OCT, 28)] = "Ημέρα του Όχι [Ochi Day]"

        # Christmas
        self[date(year, DEC, 25)] = "Χριστούγεννα [Christmas]"

        # Day after Christmas
        self[date(year, DEC, 26)] = \
            "Επόμενη ημέρα των Χριστουγέννων [Day after Christmas]" 
开发者ID:dr-prodigy,项目名称:python-holidays,代码行数:39,代码来源:greece.py

示例13: _populate

# 需要导入模块: from dateutil import easter [as 别名]
# 或者: from dateutil.easter import easter [as 别名]
def _populate(self, year):
        super(PortugalExt, self)._populate(year)

        e = easter(year)
        self[e - rd(days=47)] = "Carnaval"
        self[date(year, DEC, 24)] = "Véspera de Natal"
        self[date(year, DEC, 26)] = "26 de Dezembro"
        self[date(year, DEC, 31)] = "Véspera de Ano Novo"
        self[date(year, 6, 13)] = "Dia de Santo António"

        # TODO add bridging days
        # - get Holidays that occur on Tuesday  and add Monday (-1 day)
        # - get Holidays that occur on Thursday and add Friday (+1 day) 
开发者ID:dr-prodigy,项目名称:python-holidays,代码行数:15,代码来源:portugal.py

示例14: _populate

# 需要导入模块: from dateutil import easter [as 别名]
# 或者: from dateutil.easter import easter [as 别名]
def _populate(self, year):
        self[date(year, JAN, 1)] = "Den obnovy samostatného českého" \
                                   " státu" \
            if year >= 2000 else \
            "Nový rok"

        e = easter(year)
        if year <= 1951 or year >= 2016:
            self[e - rd(days=2)] = "Velký pátek"
        self[e + rd(days=1)] = "Velikonoční pondělí"

        if year >= 1951:
            self[date(year, MAY, 1)] = "Svátek práce"
        if year >= 1992:
            self[date(year, MAY, 8)] = "Den vítězství"
        elif year >= 1947:
            self[date(year, MAY, 9)] = "Den vítězství nad hitlerovským" \
                                       " fašismem"
        if year >= 1951:
            self[date(year, JUL, 5)] = "Den slovanských věrozvěstů " \
                "Cyrila a Metoděje"
            self[date(year, JUL, 6)] = "Den upálení mistra Jana Husa"
        if year >= 2000:
            self[date(year, SEP, 28)] = "Den české státnosti"
        if year >= 1951:
            self[date(year, OCT, 28)] = "Den vzniku samostatného " \
                "československého státu"
        if year >= 1990:
            self[date(year, NOV, 17)] = "Den boje za svobodu a demokracii"

        if year >= 1990:
            self[date(year, DEC, 24)] = "Štědrý den"
        if year >= 1951:
            self[date(year, DEC, 25)] = "1. svátek vánoční"
            self[date(year, DEC, 26)] = "2. svátek vánoční" 
开发者ID:dr-prodigy,项目名称:python-holidays,代码行数:37,代码来源:czechia.py

示例15: _populate

# 需要导入模块: from dateutil import easter [as 别名]
# 或者: from dateutil.easter import easter [as 别名]
def _populate(self, year):
        self[date(year, JAN, 1)] = "New Year's Day"
        e = easter(year)
        self[e - rd(days=2)] = "Good Friday"
        self[e + rd(days=1)] = "Easter Monday"
        self[date(year, MAY, 1)] = "1 May (Labour Day)"
        self[date(year, DEC, 25)] = "Christmas Day"
        self[date(year, DEC, 26)] = "26 December" 
开发者ID:dr-prodigy,项目名称:python-holidays,代码行数:10,代码来源:european_central_bank.py


注:本文中的dateutil.easter.easter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。