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


Python testing.assert_copy方法代碼示例

本文整理匯總了Python中pandas.util.testing.assert_copy方法的典型用法代碼示例。如果您正苦於以下問題:Python testing.assert_copy方法的具體用法?Python testing.assert_copy怎麽用?Python testing.assert_copy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pandas.util.testing的用法示例。


在下文中一共展示了testing.assert_copy方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: assert_multiindex_copied

# 需要導入模塊: from pandas.util import testing [as 別名]
# 或者: from pandas.util.testing import assert_copy [as 別名]
def assert_multiindex_copied(copy, original):
    # Levels should be (at least, shallow copied)
    tm.assert_copy(copy.levels, original.levels)
    tm.assert_almost_equal(copy.codes, original.codes)

    # Labels doesn't matter which way copied
    tm.assert_almost_equal(copy.codes, original.codes)
    assert copy.codes is not original.codes

    # Names doesn't matter which way copied
    assert copy.names == original.names
    assert copy.names is not original.names

    # Sort order should be copied
    assert copy.sortorder == original.sortorder 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:17,代碼來源:test_copy.py

示例2: test_astype

# 需要導入模塊: from pandas.util import testing [as 別名]
# 或者: from pandas.util.testing import assert_copy [as 別名]
def test_astype(self):
        expected = self.index.copy()
        actual = self.index.astype('O')
        assert_copy(actual.levels, expected.levels)
        assert_copy(actual.labels, expected.labels)
        self.check_level_names(actual, expected.names)

        with tm.assert_raises_regex(TypeError, "^Setting.*dtype.*object"):
            self.index.astype(np.dtype(int)) 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:11,代碼來源:test_multi.py

示例3: assert_multiindex_copied

# 需要導入模塊: from pandas.util import testing [as 別名]
# 或者: from pandas.util.testing import assert_copy [as 別名]
def assert_multiindex_copied(self, copy, original):
        # Levels should be (at least, shallow copied)
        tm.assert_copy(copy.levels, original.levels)
        tm.assert_almost_equal(copy.labels, original.labels)

        # Labels doesn't matter which way copied
        tm.assert_almost_equal(copy.labels, original.labels)
        assert copy.labels is not original.labels

        # Names doesn't matter which way copied
        assert copy.names == original.names
        assert copy.names is not original.names

        # Sort order should be copied
        assert copy.sortorder == original.sortorder 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:17,代碼來源:test_multi.py


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