def test_unique_label_indices():
from pandas.hashtable import unique_label_indices
a = np.random.randint(1, 1 << 10, 1 << 15).astype('i8')
left = unique_label_indices(a)
right = np.unique(a, return_index=True)[1]
tm.assert_numpy_array_equal(left, right)
a[np.random.choice(len(a), 10)] = -1
left = unique_label_indices(a)
right = np.unique(a, return_index=True)[1][1:]
tm.assert_numpy_array_equal(left, right)
test_algos.py 文件源码
python
阅读 45
收藏 0
点赞 0
评论 0
评论列表
文章目录