本文整理匯總了Python中arctic.tickstore.toplevel.TopLevelTickStore._slice方法的典型用法代碼示例。如果您正苦於以下問題:Python TopLevelTickStore._slice方法的具體用法?Python TopLevelTickStore._slice怎麽用?Python TopLevelTickStore._slice使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類arctic.tickstore.toplevel.TopLevelTickStore
的用法示例。
在下文中一共展示了TopLevelTickStore._slice方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_slice_pandas_dataframe
# 需要導入模塊: from arctic.tickstore.toplevel import TopLevelTickStore [as 別名]
# 或者: from arctic.tickstore.toplevel.TopLevelTickStore import _slice [as 別名]
def test_slice_pandas_dataframe(start, end, expected_start_index, expected_end_index):
top_level_tick_store = TopLevelTickStore(Mock())
dates = pd.date_range("20100101", periods=5, freq="2D")
data = pd.DataFrame(np.random.randn(5, 4), index=dates, columns=list("ABCD"))
expected = data.ix[expected_start_index:expected_end_index]
result = top_level_tick_store._slice(data, start, end)
assert_frame_equal(expected, result), "{}\n{}".format(expected, result)
示例2: test_slice_list_of_dicts
# 需要導入模塊: from arctic.tickstore.toplevel import TopLevelTickStore [as 別名]
# 或者: from arctic.tickstore.toplevel.TopLevelTickStore import _slice [as 別名]
def test_slice_list_of_dicts(start, end, expected_start_index, expected_end_index):
top_level_tick_store = TopLevelTickStore(Mock())
dates = list(rrule(DAILY, count=5, dtstart=dt(2010, 1, 1), interval=2))
data = [{"index": date, "A": val} for date, val in zip(dates, range(5))]
expected = data[expected_start_index:expected_end_index]
result = top_level_tick_store._slice(data, start, end)
assert expected == result
示例3: test_slice_raises
# 需要導入模塊: from arctic.tickstore.toplevel import TopLevelTickStore [as 別名]
# 或者: from arctic.tickstore.toplevel.TopLevelTickStore import _slice [as 別名]
def test_slice_raises():
m = TopLevelTickStore(Mock())
with pytest.raises(UnhandledDtypeException) as e:
m._slice("abc", 1, 2)
assert("Can't persist type" in str(e))