当前位置: 首页>>代码示例>>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;未经允许,请勿转载。