當前位置: 首頁>>代碼示例>>Python>>正文


Python testing.assert_class_equal方法代碼示例

本文整理匯總了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'] == [] 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:12,代碼來源:test_indexing.py

示例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) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:14,代碼來源:test_frame.py

示例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") 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:9,代碼來源:test_packers.py

示例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") 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:10,代碼來源:test_packers.py

示例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) 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:14,代碼來源:test_frame.py


注:本文中的pandas.util.testing.assert_class_equal方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。