Beispiel #1
0
 def test_duplicated_first(self, dtype, writable):
     N = 100
     values = np.repeat(np.arange(N).astype(dtype), 5)
     values.flags.writeable = writable
     result = ht.duplicated(values)
     expected = np.ones_like(values, dtype=np.bool_)
     expected[::5] = False
     tm.assert_numpy_array_equal(result, expected)
Beispiel #2
0
def test_duplicated_large(keep):
    # GH 9125
    n, k = 200, 5000
    levels = [np.arange(n), tm.makeStringIndex(n), 1000 + np.arange(n)]
    codes = [np.random.choice(n, k * n) for lev in levels]
    mi = MultiIndex(levels=levels, codes=codes)

    result = mi.duplicated(keep=keep)
    expected = hashtable.duplicated(mi.values, keep=keep)
    tm.assert_numpy_array_equal(result, expected)
Beispiel #3
0
 def test_duplicated_first(self, dtype):
     values = np.array([np.nan, np.nan, np.nan], dtype=dtype)
     result = ht.duplicated(values)
     expected = np.array([False, True, True])
     tm.assert_numpy_array_equal(result, expected)