本文整理汇总了Python中pandas._libs.hashtable.StringHashTable方法的典型用法代码示例。如果您正苦于以下问题:Python hashtable.StringHashTable方法的具体用法?Python hashtable.StringHashTable怎么用?Python hashtable.StringHashTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandas._libs.hashtable
的用法示例。
在下文中一共展示了hashtable.StringHashTable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_data_algo
# 需要导入模块: from pandas._libs import hashtable [as 别名]
# 或者: from pandas._libs.hashtable import StringHashTable [as 别名]
def _get_data_algo(values, func_map):
if is_categorical_dtype(values):
values = values._values_for_rank()
values, dtype, ndtype = _ensure_data(values)
if ndtype == 'object':
# it's cheaper to use a String Hash Table than Object; we infer
# including nulls because that is the only difference between
# StringHashTable and ObjectHashtable
if lib.infer_dtype(values, skipna=False) in ['string']:
ndtype = 'string'
f = func_map.get(ndtype, func_map['object'])
return f, values
# --------------- #
# top-level algos #
# --------------- #
示例2: _get_hashtable_algo
# 需要导入模块: from pandas._libs import hashtable [as 别名]
# 或者: from pandas._libs.hashtable import StringHashTable [as 别名]
def _get_hashtable_algo(values):
"""
Parameters
----------
values : arraylike
Returns
-------
tuples(hashtable class,
vector class,
values,
dtype,
ndtype)
"""
values, dtype, ndtype = _ensure_data(values)
if ndtype == 'object':
# it's cheaper to use a String Hash Table than Object; we infer
# including nulls because that is the only difference between
# StringHashTable and ObjectHashtable
if lib.infer_dtype(values, skipna=False) in ['string']:
ndtype = 'string'
else:
ndtype = 'object'
htable, table = _hashtables[ndtype]
return (htable, table, values, dtype, ndtype)