本文整理匯總了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)