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


Python offsets.Milli方法代码示例

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


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

示例1: test_Millisecond

# 需要导入模块: from pandas.tseries import offsets [as 别名]
# 或者: from pandas.tseries.offsets import Milli [as 别名]
def test_Millisecond():
    assert_offset_equal(Milli(),
                        datetime(2010, 1, 1),
                        datetime(2010, 1, 1, 0, 0, 0, 1000))
    assert_offset_equal(Milli(-1),
                        datetime(2010, 1, 1, 0, 0, 0, 1000),
                        datetime(2010, 1, 1))
    assert_offset_equal(Milli(2),
                        datetime(2010, 1, 1),
                        datetime(2010, 1, 1, 0, 0, 0, 2000))
    assert_offset_equal(2 * Milli(),
                        datetime(2010, 1, 1),
                        datetime(2010, 1, 1, 0, 0, 0, 2000))
    assert_offset_equal(-1 * Milli(),
                        datetime(2010, 1, 1, 0, 0, 0, 1000),
                        datetime(2010, 1, 1))

    assert Milli(3) + Milli(2) == Milli(5)
    assert Milli(3) - Milli(2) == Milli() 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:21,代码来源:test_ticks.py

示例2: test_is_superperiod_subperiod

# 需要导入模块: from pandas.tseries import offsets [as 别名]
# 或者: from pandas.tseries.offsets import Milli [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_is_superperiod_subperiod

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

示例4: test_resolution

# 需要导入模块: from pandas.tseries import offsets [as 别名]
# 或者: from pandas.tseries.offsets import Milli [as 别名]
def test_resolution(self):
        def _assert_less(ts1, ts2):
            val1 = self.dtc.convert(ts1, None, None)
            val2 = self.dtc.convert(ts2, None, None)
            if not val1 < val2:
                raise AssertionError('{0} is not less than {1}.'.format(val1,
                                                                        val2))

        # Matplotlib's time representation using floats cannot distinguish
        # intervals smaller than ~10 microsecond in the common range of years.
        ts = Timestamp('2012-1-1')
        _assert_less(ts, ts + Second())
        _assert_less(ts, ts + Milli())
        _assert_less(ts, ts + Micro(50)) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:16,代码来源:test_converter.py

示例5: test_MillisecondTimestampArithmetic

# 需要导入模块: from pandas.tseries import offsets [as 别名]
# 或者: from pandas.tseries.offsets import Milli [as 别名]
def test_MillisecondTimestampArithmetic():
    assert_offset_equal(Milli(),
                        Timestamp('2010-01-01'),
                        Timestamp('2010-01-01 00:00:00.001'))
    assert_offset_equal(Milli(-1),
                        Timestamp('2010-01-01 00:00:00.001'),
                        Timestamp('2010-01-01')) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:9,代码来源:test_ticks.py

示例6: test_ms_vs_MS

# 需要导入模块: from pandas.tseries import offsets [as 别名]
# 或者: from pandas.tseries.offsets import Milli [as 别名]
def test_ms_vs_MS():
    left = frequencies.get_offset('ms')
    right = frequencies.get_offset('MS')
    assert left == offsets.Milli()
    assert right == offsets.MonthBegin() 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:7,代码来源:test_frequencies.py

示例7: test_to_offset_multiple

# 需要导入模块: from pandas.tseries import offsets [as 别名]
# 或者: from pandas.tseries.offsets import Milli [as 别名]
def test_to_offset_multiple():
    freqstr = '2h30min'
    freqstr2 = '2h 30min'

    result = to_offset(freqstr)
    assert(result == to_offset(freqstr2))
    expected = offsets.Minute(150)
    assert(result == expected)

    freqstr = '2h30min15s'
    result = to_offset(freqstr)
    expected = offsets.Second(150 * 60 + 15)
    assert(result == expected)

    freqstr = '2h 60min'
    result = to_offset(freqstr)
    expected = offsets.Hour(3)
    assert(result == expected)

    freqstr = '15l500u'
    result = to_offset(freqstr)
    expected = offsets.Micro(15500)
    assert(result == expected)

    freqstr = '10s75L'
    result = to_offset(freqstr)
    expected = offsets.Milli(10075)
    assert(result == expected)

    if not _np_version_under1p7:
        freqstr = '2800N'
        result = to_offset(freqstr)
        expected = offsets.Nano(2800)
        assert(result == expected)

    # malformed
    try:
        to_offset('2h20m')
    except ValueError:
        pass
    else:
        assert(False) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:44,代码来源:test_frequencies.py


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