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


Python offsets._delta_to_tick方法代码示例

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


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

示例1: test_delta_to_tick

# 需要导入模块: from pandas.tseries import offsets [as 别名]
# 或者: from pandas.tseries.offsets import _delta_to_tick [as 别名]
def test_delta_to_tick():
    delta = timedelta(3)

    tick = offsets._delta_to_tick(delta)
    assert (tick == offsets.Day(3))

    td = Timedelta(nanoseconds=5)
    tick = offsets._delta_to_tick(td)
    assert tick == Nano(5) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:11,代码来源:test_ticks.py

示例2: _raise_on_incompatible

# 需要导入模块: from pandas.tseries import offsets [as 别名]
# 或者: from pandas.tseries.offsets import _delta_to_tick [as 别名]
def _raise_on_incompatible(left, right):
    """
    Helper function to render a consistent error message when raising
    IncompatibleFrequency.

    Parameters
    ----------
    left : PeriodArray
    right : DateOffset, Period, ndarray, or timedelta-like

    Raises
    ------
    IncompatibleFrequency
    """
    # GH#24283 error message format depends on whether right is scalar
    if isinstance(right, np.ndarray):
        other_freq = None
    elif isinstance(right, (ABCPeriodIndex, PeriodArray, Period, DateOffset)):
        other_freq = right.freqstr
    else:
        other_freq = _delta_to_tick(Timedelta(right)).freqstr

    msg = DIFFERENT_FREQ.format(cls=type(left).__name__,
                                own_freq=left.freqstr,
                                other_freq=other_freq)
    raise IncompatibleFrequency(msg)


# -------------------------------------------------------------------
# Constructor Helpers 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:32,代码来源:period.py

示例3: test_delta_to_tick

# 需要导入模块: from pandas.tseries import offsets [as 别名]
# 或者: from pandas.tseries.offsets import _delta_to_tick [as 别名]
def test_delta_to_tick():
    delta = timedelta(3)

    tick = offsets._delta_to_tick(delta)
    assert (tick == offsets.Day(3))


# --------------------------------------------------------------------- 
开发者ID:birforce,项目名称:vnpy_crypto,代码行数:10,代码来源:test_ticks.py

示例4: test_delta_to_tick

# 需要导入模块: from pandas.tseries import offsets [as 别名]
# 或者: from pandas.tseries.offsets import _delta_to_tick [as 别名]
def test_delta_to_tick():
    delta = timedelta(3)

    tick = offsets._delta_to_tick(delta)
    assert(tick == offsets.Day(3)) 
开发者ID:ktraunmueller,项目名称:Computable,代码行数:7,代码来源:test_offsets.py


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