本文整理汇总了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)
示例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
示例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))
# ---------------------------------------------------------------------
示例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))