本文整理汇总了Python中pandas.core.dtypes.concat.get_dtype_kinds方法的典型用法代码示例。如果您正苦于以下问题:Python concat.get_dtype_kinds方法的具体用法?Python concat.get_dtype_kinds怎么用?Python concat.get_dtype_kinds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandas.core.dtypes.concat
的用法示例。
在下文中一共展示了concat.get_dtype_kinds方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_dtype_kinds_period
# 需要导入模块: from pandas.core.dtypes import concat [as 别名]
# 或者: from pandas.core.dtypes.concat import get_dtype_kinds [as 别名]
def test_get_dtype_kinds_period(self):
# because we don't have Period dtype (yet),
# Series results in object dtype
to_concat = [pd.PeriodIndex(['2011-01'], freq='M'),
pd.PeriodIndex(['2011-01'], freq='M')]
res = _concat.get_dtype_kinds(to_concat)
assert res == set(['period[M]'])
to_concat = [pd.Series([pd.Period('2011-01', freq='M')]),
pd.Series([pd.Period('2011-02', freq='M')])]
res = _concat.get_dtype_kinds(to_concat)
assert res == set(['object'])
to_concat = [pd.PeriodIndex(['2011-01'], freq='M'),
pd.PeriodIndex(['2011-01'], freq='D')]
res = _concat.get_dtype_kinds(to_concat)
assert res == set(['period[M]', 'period[D]'])
to_concat = [pd.Series([pd.Period('2011-01', freq='M')]),
pd.Series([pd.Period('2011-02', freq='D')])]
res = _concat.get_dtype_kinds(to_concat)
assert res == set(['object'])
示例2: test_get_dtype_kinds
# 需要导入模块: from pandas.core.dtypes import concat [as 别名]
# 或者: from pandas.core.dtypes.concat import get_dtype_kinds [as 别名]
def test_get_dtype_kinds(klass, to_concat, expected):
to_concat_klass = [klass(c) for c in to_concat]
result = _concat.get_dtype_kinds(to_concat_klass)
assert result == set(expected)
示例3: test_get_dtype_kinds_period
# 需要导入模块: from pandas.core.dtypes import concat [as 别名]
# 或者: from pandas.core.dtypes.concat import get_dtype_kinds [as 别名]
def test_get_dtype_kinds_period(to_concat, expected):
result = _concat.get_dtype_kinds(to_concat)
assert result == set(expected)
示例4: _concat
# 需要导入模块: from pandas.core.dtypes import concat [as 别名]
# 或者: from pandas.core.dtypes.concat import get_dtype_kinds [as 别名]
def _concat(self, to_concat, name):
typs = _concat.get_dtype_kinds(to_concat)
if len(typs) == 1:
return self._concat_same_dtype(to_concat, name=name)
return _concat._concat_index_asobject(to_concat, name=name)
示例5: check_concat
# 需要导入模块: from pandas.core.dtypes import concat [as 别名]
# 或者: from pandas.core.dtypes.concat import get_dtype_kinds [as 别名]
def check_concat(self, to_concat, exp):
for klass in [pd.Index, pd.Series]:
to_concat_klass = [klass(c) for c in to_concat]
res = _concat.get_dtype_kinds(to_concat_klass)
assert res == set(exp)