本文整理汇总了Python中pandas.util.testing.assert_class_equal方法的典型用法代码示例。如果您正苦于以下问题:Python testing.assert_class_equal方法的具体用法?Python testing.assert_class_equal怎么用?Python testing.assert_class_equal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pandas.util.testing
的用法示例。
在下文中一共展示了testing.assert_class_equal方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_series_indexing_single
# 需要导入模块: from pandas.util import testing [as 别名]
# 或者: from pandas.util.testing import assert_class_equal [as 别名]
def test_series_indexing_single(self):
for i, idx in enumerate(self.cols):
assert self.ss.iloc[i] == self.ss[idx]
tm.assert_class_equal(self.ss.iloc[i], self.ss[idx],
obj="series index")
assert self.ss['string'] == 'a'
assert self.ss['int'] == 1
assert self.ss['float'] == 1.1
assert self.ss['object'] == []
示例2: test_iloc
# 需要导入模块: from pandas.util import testing [as 别名]
# 或者: from pandas.util.testing import assert_class_equal [as 别名]
def test_iloc(self, float_frame):
# GH 2227
result = float_frame.iloc[:, 0]
assert isinstance(result, SparseSeries)
tm.assert_sp_series_equal(result, float_frame['A'])
# preserve sparse index type. #2251
data = {'A': [0, 1]}
iframe = SparseDataFrame(data, default_kind='integer')
tm.assert_class_equal(iframe['A'].sp_index,
iframe.iloc[:, 0].sp_index)
示例3: test_dict_complex
# 需要导入模块: from pandas.util import testing [as 别名]
# 或者: from pandas.util.testing import assert_class_equal [as 别名]
def test_dict_complex(self):
x = {'foo': 1.0 + 1.0j, 'bar': 2.0 + 2.0j}
x_rec = self.encode_decode(x)
tm.assert_dict_equal(x, x_rec)
for key in x:
tm.assert_class_equal(x[key], x_rec[key], obj="complex value")
示例4: test_dict_numpy_complex
# 需要导入模块: from pandas.util import testing [as 别名]
# 或者: from pandas.util.testing import assert_class_equal [as 别名]
def test_dict_numpy_complex(self):
x = {'foo': np.complex128(1.0 + 1.0j),
'bar': np.complex128(2.0 + 2.0j)}
x_rec = self.encode_decode(x)
tm.assert_dict_equal(x, x_rec)
for key in x:
tm.assert_class_equal(x[key], x_rec[key], obj="numpy complex128")
示例5: test_iloc
# 需要导入模块: from pandas.util import testing [as 别名]
# 或者: from pandas.util.testing import assert_class_equal [as 别名]
def test_iloc(self):
# 2227
result = self.frame.iloc[:, 0]
assert isinstance(result, SparseSeries)
tm.assert_sp_series_equal(result, self.frame['A'])
# preserve sparse index type. #2251
data = {'A': [0, 1]}
iframe = SparseDataFrame(data, default_kind='integer')
tm.assert_class_equal(iframe['A'].sp_index,
iframe.iloc[:, 0].sp_index)