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