当前位置: 首页>>代码示例>>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;未经允许,请勿转载。