本文整理匯總了Python中pandas.util.testing.SubclassedCategorical方法的典型用法代碼示例。如果您正苦於以下問題:Python testing.SubclassedCategorical方法的具體用法?Python testing.SubclassedCategorical怎麽用?Python testing.SubclassedCategorical使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pandas.util.testing
的用法示例。
在下文中一共展示了testing.SubclassedCategorical方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_constructor
# 需要導入模塊: from pandas.util import testing [as 別名]
# 或者: from pandas.util.testing import SubclassedCategorical [as 別名]
def test_constructor(self):
sc = tm.SubclassedCategorical(['a', 'b', 'c'])
assert isinstance(sc, tm.SubclassedCategorical)
tm.assert_categorical_equal(sc, Categorical(['a', 'b', 'c']))
示例2: test_from_codes
# 需要導入模塊: from pandas.util import testing [as 別名]
# 或者: from pandas.util.testing import SubclassedCategorical [as 別名]
def test_from_codes(self):
sc = tm.SubclassedCategorical.from_codes([1, 0, 2], ['a', 'b', 'c'])
assert isinstance(sc, tm.SubclassedCategorical)
exp = Categorical.from_codes([1, 0, 2], ['a', 'b', 'c'])
tm.assert_categorical_equal(sc, exp)
示例3: test_map
# 需要導入模塊: from pandas.util import testing [as 別名]
# 或者: from pandas.util.testing import SubclassedCategorical [as 別名]
def test_map(self):
sc = tm.SubclassedCategorical(['a', 'b', 'c'])
res = sc.map(lambda x: x.upper())
assert isinstance(res, tm.SubclassedCategorical)
exp = Categorical(['A', 'B', 'C'])
tm.assert_categorical_equal(res, exp)
示例4: test_from_array
# 需要導入模塊: from pandas.util import testing [as 別名]
# 或者: from pandas.util.testing import SubclassedCategorical [as 別名]
def test_from_array(self):
sc = tm.SubclassedCategorical.from_codes([1, 0, 2], ['a', 'b', 'c'])
assert isinstance(sc, tm.SubclassedCategorical)
exp = Categorical.from_codes([1, 0, 2], ['a', 'b', 'c'])
tm.assert_categorical_equal(sc, exp)