當前位置: 首頁>>代碼示例>>Python>>正文


Python offsets.YearEnd方法代碼示例

本文整理匯總了Python中pandas.tseries.offsets.YearEnd方法的典型用法代碼示例。如果您正苦於以下問題:Python offsets.YearEnd方法的具體用法?Python offsets.YearEnd怎麽用?Python offsets.YearEnd使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pandas.tseries.offsets的用法示例。


在下文中一共展示了offsets.YearEnd方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_freq_group

# 需要導入模塊: from pandas.tseries import offsets [as 別名]
# 或者: from pandas.tseries.offsets import YearEnd [as 別名]
def test_freq_group(self):
        assert resolution.get_freq_group('A') == 1000
        assert resolution.get_freq_group('3A') == 1000
        assert resolution.get_freq_group('-1A') == 1000
        assert resolution.get_freq_group('A-JAN') == 1000
        assert resolution.get_freq_group('A-MAY') == 1000

        assert resolution.get_freq_group('Y') == 1000
        assert resolution.get_freq_group('3Y') == 1000
        assert resolution.get_freq_group('-1Y') == 1000
        assert resolution.get_freq_group('Y-JAN') == 1000
        assert resolution.get_freq_group('Y-MAY') == 1000

        assert resolution.get_freq_group(offsets.YearEnd()) == 1000
        assert resolution.get_freq_group(offsets.YearEnd(month=1)) == 1000
        assert resolution.get_freq_group(offsets.YearEnd(month=5)) == 1000

        assert resolution.get_freq_group('W') == 4000
        assert resolution.get_freq_group('W-MON') == 4000
        assert resolution.get_freq_group('W-FRI') == 4000
        assert resolution.get_freq_group(offsets.Week()) == 4000
        assert resolution.get_freq_group(offsets.Week(weekday=1)) == 4000
        assert resolution.get_freq_group(offsets.Week(weekday=5)) == 4000 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:25,代碼來源:test_frequencies.py

示例2: test_is_superperiod_subperiod

# 需要導入模塊: from pandas.tseries import offsets [as 別名]
# 或者: from pandas.tseries.offsets import YearEnd [as 別名]
def test_is_superperiod_subperiod():

    # input validation
    assert not (is_superperiod(offsets.YearEnd(), None))
    assert not (is_subperiod(offsets.MonthEnd(), None))
    assert not (is_superperiod(None, offsets.YearEnd()))
    assert not (is_subperiod(None, offsets.MonthEnd()))
    assert not (is_superperiod(None, None))
    assert not (is_subperiod(None, None))

    assert (is_superperiod(offsets.YearEnd(), offsets.MonthEnd()))
    assert (is_subperiod(offsets.MonthEnd(), offsets.YearEnd()))

    assert (is_superperiod(offsets.Hour(), offsets.Minute()))
    assert (is_subperiod(offsets.Minute(), offsets.Hour()))

    assert (is_superperiod(offsets.Second(), offsets.Milli()))
    assert (is_subperiod(offsets.Milli(), offsets.Second()))

    assert (is_superperiod(offsets.Milli(), offsets.Micro()))
    assert (is_subperiod(offsets.Micro(), offsets.Milli()))

    assert (is_superperiod(offsets.Micro(), offsets.Nano()))
    assert (is_subperiod(offsets.Nano(), offsets.Micro())) 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:26,代碼來源:test_libfrequencies.py

示例3: test_freq_group

# 需要導入模塊: from pandas.tseries import offsets [as 別名]
# 或者: from pandas.tseries.offsets import YearEnd [as 別名]
def test_freq_group(self):
        assert frequencies.get_freq_group('A') == 1000
        assert frequencies.get_freq_group('3A') == 1000
        assert frequencies.get_freq_group('-1A') == 1000
        assert frequencies.get_freq_group('A-JAN') == 1000
        assert frequencies.get_freq_group('A-MAY') == 1000

        assert frequencies.get_freq_group('Y') == 1000
        assert frequencies.get_freq_group('3Y') == 1000
        assert frequencies.get_freq_group('-1Y') == 1000
        assert frequencies.get_freq_group('Y-JAN') == 1000
        assert frequencies.get_freq_group('Y-MAY') == 1000

        assert frequencies.get_freq_group(offsets.YearEnd()) == 1000
        assert frequencies.get_freq_group(offsets.YearEnd(month=1)) == 1000
        assert frequencies.get_freq_group(offsets.YearEnd(month=5)) == 1000

        assert frequencies.get_freq_group('W') == 4000
        assert frequencies.get_freq_group('W-MON') == 4000
        assert frequencies.get_freq_group('W-FRI') == 4000
        assert frequencies.get_freq_group(offsets.Week()) == 4000
        assert frequencies.get_freq_group(offsets.Week(weekday=1)) == 4000
        assert frequencies.get_freq_group(offsets.Week(weekday=5)) == 4000 
開發者ID:securityclippy,項目名稱:elasticintel,代碼行數:25,代碼來源:test_frequencies.py

示例4: test_is_superperiod_subperiod

# 需要導入模塊: from pandas.tseries import offsets [as 別名]
# 或者: from pandas.tseries.offsets import YearEnd [as 別名]
def test_is_superperiod_subperiod():

    # input validation
    assert not (frequencies.is_superperiod(offsets.YearEnd(), None))
    assert not (frequencies.is_subperiod(offsets.MonthEnd(), None))
    assert not (frequencies.is_superperiod(None, offsets.YearEnd()))
    assert not (frequencies.is_subperiod(None, offsets.MonthEnd()))
    assert not (frequencies.is_superperiod(None, None))
    assert not (frequencies.is_subperiod(None, None))

    assert (frequencies.is_superperiod(offsets.YearEnd(), offsets.MonthEnd()))
    assert (frequencies.is_subperiod(offsets.MonthEnd(), offsets.YearEnd()))

    assert (frequencies.is_superperiod(offsets.Hour(), offsets.Minute()))
    assert (frequencies.is_subperiod(offsets.Minute(), offsets.Hour()))

    assert (frequencies.is_superperiod(offsets.Second(), offsets.Milli()))
    assert (frequencies.is_subperiod(offsets.Milli(), offsets.Second()))

    assert (frequencies.is_superperiod(offsets.Milli(), offsets.Micro()))
    assert (frequencies.is_subperiod(offsets.Micro(), offsets.Milli()))

    assert (frequencies.is_superperiod(offsets.Micro(), offsets.Nano()))
    assert (frequencies.is_subperiod(offsets.Nano(), offsets.Micro())) 
開發者ID:securityclippy,項目名稱:elasticintel,代碼行數:26,代碼來源:test_frequencies.py

示例5: test_get_rule_month

# 需要導入模塊: from pandas.tseries import offsets [as 別名]
# 或者: from pandas.tseries.offsets import YearEnd [as 別名]
def test_get_rule_month():
    result = get_rule_month('W')
    assert (result == 'DEC')
    result = get_rule_month(offsets.Week())
    assert (result == 'DEC')

    result = get_rule_month('D')
    assert (result == 'DEC')
    result = get_rule_month(offsets.Day())
    assert (result == 'DEC')

    result = get_rule_month('Q')
    assert (result == 'DEC')
    result = get_rule_month(offsets.QuarterEnd(startingMonth=12))

    result = get_rule_month('Q-JAN')
    assert (result == 'JAN')
    result = get_rule_month(offsets.QuarterEnd(startingMonth=1))
    assert (result == 'JAN')

    result = get_rule_month('A-DEC')
    assert (result == 'DEC')
    result = get_rule_month('Y-DEC')
    assert (result == 'DEC')
    result = get_rule_month(offsets.YearEnd())
    assert (result == 'DEC')

    result = get_rule_month('A-MAY')
    assert (result == 'MAY')
    result = get_rule_month('Y-MAY')
    assert (result == 'MAY')
    result = get_rule_month(offsets.YearEnd(month=5))
    assert (result == 'MAY') 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:35,代碼來源:test_libfrequencies.py

示例6: test_is_superperiod_subperiod

# 需要導入模塊: from pandas.tseries import offsets [as 別名]
# 或者: from pandas.tseries.offsets import YearEnd [as 別名]
def test_is_superperiod_subperiod():
    assert(fmod.is_superperiod(offsets.YearEnd(), offsets.MonthEnd()))
    assert(fmod.is_subperiod(offsets.MonthEnd(), offsets.YearEnd()))

    assert(fmod.is_superperiod(offsets.Hour(), offsets.Minute()))
    assert(fmod.is_subperiod(offsets.Minute(), offsets.Hour())) 
開發者ID:ktraunmueller,項目名稱:Computable,代碼行數:8,代碼來源:test_frequencies.py

示例7: test_get_rule_month

# 需要導入模塊: from pandas.tseries import offsets [as 別名]
# 或者: from pandas.tseries.offsets import YearEnd [as 別名]
def test_get_rule_month():
    result = frequencies._get_rule_month('W')
    assert (result == 'DEC')
    result = frequencies._get_rule_month(offsets.Week())
    assert (result == 'DEC')

    result = frequencies._get_rule_month('D')
    assert (result == 'DEC')
    result = frequencies._get_rule_month(offsets.Day())
    assert (result == 'DEC')

    result = frequencies._get_rule_month('Q')
    assert (result == 'DEC')
    result = frequencies._get_rule_month(offsets.QuarterEnd(startingMonth=12))
    print(result == 'DEC')

    result = frequencies._get_rule_month('Q-JAN')
    assert (result == 'JAN')
    result = frequencies._get_rule_month(offsets.QuarterEnd(startingMonth=1))
    assert (result == 'JAN')

    result = frequencies._get_rule_month('A-DEC')
    assert (result == 'DEC')
    result = frequencies._get_rule_month('Y-DEC')
    assert (result == 'DEC')
    result = frequencies._get_rule_month(offsets.YearEnd())
    assert (result == 'DEC')

    result = frequencies._get_rule_month('A-MAY')
    assert (result == 'MAY')
    result = frequencies._get_rule_month('Y-MAY')
    assert (result == 'MAY')
    result = frequencies._get_rule_month(offsets.YearEnd(month=5))
    assert (result == 'MAY') 
開發者ID:securityclippy,項目名稱:elasticintel,代碼行數:36,代碼來源:test_frequencies.py

示例8: eoy

# 需要導入模塊: from pandas.tseries import offsets [as 別名]
# 或者: from pandas.tseries.offsets import YearEnd [as 別名]
def eoy(d, offset=0):
        """Unmodified end-of-year. Returns the last date of year for the
        same year as in date d

        The offset parameter represents the number of years that will be
        added (if offset > 0) or subtracted (if offset < 0) to input date d.
        This is especially useful for offset = -1, which gives you the EOY
        of previous year, for example.
        """
        d = to_datetime(d)
        # As in the case of the EOM, we leave the offset to a different
        # function (see comments of EOM function)
        return d + DateOffset(years=offset) + YearEnd(0) 
開發者ID:Finance-Hub,項目名稱:FinanceHub,代碼行數:15,代碼來源:daycounts.py


注:本文中的pandas.tseries.offsets.YearEnd方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。