本文整理匯總了Python中pandas._libs.lib.indices_fast方法的典型用法代碼示例。如果您正苦於以下問題:Python lib.indices_fast方法的具體用法?Python lib.indices_fast怎麽用?Python lib.indices_fast使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pandas._libs.lib
的用法示例。
在下文中一共展示了lib.indices_fast方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_indexer_dict
# 需要導入模塊: from pandas._libs import lib [as 別名]
# 或者: from pandas._libs.lib import indices_fast [as 別名]
def get_indexer_dict(label_list, keys):
""" return a diction of {labels} -> {indexers} """
shape = list(map(len, keys))
group_index = get_group_index(label_list, shape, sort=True, xnull=True)
ngroups = ((group_index.size and group_index.max()) + 1) \
if is_int64_overflow_possible(shape) \
else np.prod(shape, dtype='i8')
sorter = get_group_index_sorter(group_index, ngroups)
sorted_labels = [lab.take(sorter) for lab in label_list]
group_index = group_index.take(sorter)
return lib.indices_fast(sorter, group_index, keys, sorted_labels)
# ----------------------------------------------------------------------
# sorting levels...cleverly?