def test_reindex_different_fills(self): ds = DataSource(self.df) ds.reindex([1, 2, 3], method=None) print(ds.data) assert pd.isnull( ds.data.set_index(['symbol', 'timestamp']).at[('C', 3), 'high']) ds = DataSource(self.df) ds.reindex([1, 2, 3, 4], method='bfill') assert ds.data.set_index(['symbol', 'timestamp']).at[('B', 2), 'close'] == 19
def test_reindex_different_fills(self): ds = DataSource(self.df) ds.reindex([1, 2, 3], method=None) print(ds.data) assert pd.isnull( ds.data.set_index(["symbol", "timestamp"]).at[("C", 3), "high"] ) ds = DataSource(self.df) ds.reindex([1, 2, 3, 4], method="bfill") assert ds.data.set_index(["symbol", "timestamp"]).at[("B", 2), "close"] == 19
def test_reindex(self): ds = DataSource(self.df) ds.reindex([1, 2, 3]) assert len(ds.data) == 9 # Check values assert ds.data.set_index(["symbol", "timestamp"]).at[("A", 1), "open"] == 0 assert ds.data.set_index(["symbol", "timestamp"]).at[("B", 2), "close"] == 7 assert ds.data.set_index(["symbol", "timestamp"]).at[("C", 3), "high"] == 9 ds.reindex([1, 2, 3, 4]) assert len(ds.data) == 12
def test_reindex(self): ds = DataSource(self.df) ds.reindex([1, 2, 3]) assert len(ds.data) == 9 # Check values assert ds.data.set_index(['symbol', 'timestamp']).at[('A', 1), 'open'] == 0 assert ds.data.set_index(['symbol', 'timestamp']).at[('B', 2), 'close'] == 7 assert ds.data.set_index(['symbol', 'timestamp']).at[('C', 3), 'high'] == 9 ds.reindex([1, 2, 3, 4]) assert len(ds.data) == 12