Python pandas.tseries.offsets._delta_to_tick() Examples
The following are 8
code examples of pandas.tseries.offsets._delta_to_tick().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pandas.tseries.offsets
, or try the search function
.
Example #1
Source File: test_ticks.py From recruit with Apache License 2.0 | 5 votes |
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)
Example #2
Source File: period.py From recruit with Apache License 2.0 | 5 votes |
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
Example #3
Source File: test_ticks.py From vnpy_crypto with MIT License | 5 votes |
def test_delta_to_tick(): delta = timedelta(3) tick = offsets._delta_to_tick(delta) assert (tick == offsets.Day(3)) # ---------------------------------------------------------------------
Example #4
Source File: test_offsets.py From Computable with MIT License | 5 votes |
def test_delta_to_tick(): delta = timedelta(3) tick = offsets._delta_to_tick(delta) assert(tick == offsets.Day(3))
Example #5
Source File: test_ticks.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
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)
Example #6
Source File: period.py From predictive-maintenance-using-machine-learning with Apache License 2.0 | 5 votes |
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
Example #7
Source File: test_ticks.py From coffeegrindsize with MIT License | 5 votes |
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)
Example #8
Source File: test_ticks.py From twitter-stock-recommendation with MIT License | 5 votes |
def test_delta_to_tick(): delta = timedelta(3) tick = offsets._delta_to_tick(delta) assert (tick == offsets.Day(3)) # ---------------------------------------------------------------------