def test_backfill(self): old = Index([1, 5, 10]) new = Index(lrange(12)) filler = algos.backfill_int64(old, new) expect_filler = [0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, -1] self.assert_numpy_array_equal(filler, expect_filler) # corner case old = Index([1, 4]) new = Index(lrange(5, 10)) filler = algos.backfill_int64(old, new) expect_filler = [-1, -1, -1, -1, -1] self.assert_numpy_array_equal(filler, expect_filler)
def test_backfill(self): old = Index([1, 5, 10]) new = Index(range(12)) filler = algos.backfill_int64(old, new) expect_filler = [0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, -1] self.assert_(np.array_equal(filler, expect_filler)) # corner case old = Index([1, 4]) new = Index(range(5, 10)) filler = algos.backfill_int64(old, new) expect_filler = [-1, -1, -1, -1, -1] self.assert_(np.array_equal(filler, expect_filler))
def test_backfill(self): old = Index([1, 5, 10]) new = Index(lrange(12)) filler = algos.backfill_int64(old.values, new.values) expect_filler = [0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, -1] self.assert_numpy_array_equal(filler, expect_filler) # corner case old = Index([1, 4]) new = Index(lrange(5, 10)) filler = algos.backfill_int64(old.values, new.values) expect_filler = [-1, -1, -1, -1, -1] self.assert_numpy_array_equal(filler, expect_filler)
def test_backfill(self): old = Index([1, 5, 10]) new = Index(lrange(12)) filler = _algos.backfill_int64(old.values, new.values) expect_filler = np.array([0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, -1], dtype=np.int64) self.assert_numpy_array_equal(filler, expect_filler) # corner case old = Index([1, 4]) new = Index(lrange(5, 10)) filler = _algos.backfill_int64(old.values, new.values) expect_filler = np.array([-1, -1, -1, -1, -1], dtype=np.int64) self.assert_numpy_array_equal(filler, expect_filler)