本文整理匯總了Python中pandas.core.index._get_combined_index方法的典型用法代碼示例。如果您正苦於以下問題:Python index._get_combined_index方法的具體用法?Python index._get_combined_index怎麽用?Python index._get_combined_index使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pandas.core.index
的用法示例。
在下文中一共展示了index._get_combined_index方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_get_combined_index
# 需要導入模塊: from pandas.core import index [as 別名]
# 或者: from pandas.core.index import _get_combined_index [as 別名]
def test_get_combined_index(self):
result = _get_combined_index([])
expected = Index([])
tm.assert_index_equal(result, expected)
示例2: _list_of_series_to_arrays
# 需要導入模塊: from pandas.core import index [as 別名]
# 或者: from pandas.core.index import _get_combined_index [as 別名]
def _list_of_series_to_arrays(data, columns, coerce_float=False, dtype=None):
from pandas.core.index import _get_combined_index
if columns is None:
columns = _get_combined_index([
s.index for s in data if getattr(s, 'index', None) is not None
])
indexer_cache = {}
aligned_values = []
for s in data:
index = getattr(s, 'index', None)
if index is None:
index = _default_index(len(s))
if id(index) in indexer_cache:
indexer = indexer_cache[id(index)]
else:
indexer = indexer_cache[id(index)] = index.get_indexer(columns)
values = _values_from_object(s)
aligned_values.append(com.take_1d(values, indexer))
values = np.vstack(aligned_values)
if values.dtype == np.object_:
content = list(values.T)
return _convert_object_array(content, columns, dtype=dtype,
coerce_float=coerce_float)
else:
return values.T, columns
示例3: test_get_combined_index
# 需要導入模塊: from pandas.core import index [as 別名]
# 或者: from pandas.core.index import _get_combined_index [as 別名]
def test_get_combined_index(self):
result = _get_combined_index([])
tm.assert_index_equal(result, Index([]))