当前位置: 首页>>代码示例>>Python>>正文


Python internals.ExtensionBlock方法代码示例

本文整理汇总了Python中pandas.core.internals.ExtensionBlock方法的典型用法代码示例。如果您正苦于以下问题:Python internals.ExtensionBlock方法的具体用法?Python internals.ExtensionBlock怎么用?Python internals.ExtensionBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pandas.core.internals的用法示例。


在下文中一共展示了internals.ExtensionBlock方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_series_constructor

# 需要导入模块: from pandas.core import internals [as 别名]
# 或者: from pandas.core.internals import ExtensionBlock [as 别名]
def test_series_constructor(self, data):
        result = pd.Series(data)
        assert result.dtype == data.dtype
        assert len(result) == len(data)
        assert isinstance(result._data.blocks[0], ExtensionBlock)
        assert result._data.blocks[0].values is data

        # Series[EA] is unboxed / boxed correctly
        result2 = pd.Series(result)
        assert result2.dtype == data.dtype
        assert isinstance(result2._data.blocks[0], ExtensionBlock) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:13,代码来源:constructors.py

示例2: test_dataframe_constructor_from_dict

# 需要导入模块: from pandas.core import internals [as 别名]
# 或者: from pandas.core.internals import ExtensionBlock [as 别名]
def test_dataframe_constructor_from_dict(self, data, from_series):
        if from_series:
            data = pd.Series(data)
        result = pd.DataFrame({"A": data})
        assert result.dtypes['A'] == data.dtype
        assert result.shape == (len(data), 1)
        assert isinstance(result._data.blocks[0], ExtensionBlock) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:9,代码来源:constructors.py

示例3: test_dataframe_from_series

# 需要导入模块: from pandas.core import internals [as 别名]
# 或者: from pandas.core.internals import ExtensionBlock [as 别名]
def test_dataframe_from_series(self, data):
        result = pd.DataFrame(pd.Series(data))
        assert result.dtypes[0] == data.dtype
        assert result.shape == (len(data), 1)
        assert isinstance(result._data.blocks[0], ExtensionBlock) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:7,代码来源:constructors.py

示例4: test_concat

# 需要导入模块: from pandas.core import internals [as 别名]
# 或者: from pandas.core.internals import ExtensionBlock [as 别名]
def test_concat(self, data, in_frame):
        wrapped = pd.Series(data)
        if in_frame:
            wrapped = pd.DataFrame(wrapped)
        result = pd.concat([wrapped, wrapped], ignore_index=True)

        assert len(result) == len(data) * 2

        if in_frame:
            dtype = result.dtypes[0]
        else:
            dtype = result.dtype

        assert dtype == data.dtype
        assert isinstance(result._data.blocks[0], ExtensionBlock) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:17,代码来源:reshaping.py

示例5: test_series_constructor

# 需要导入模块: from pandas.core import internals [as 别名]
# 或者: from pandas.core.internals import ExtensionBlock [as 别名]
def test_series_constructor():
    v = fr.FletcherChunkedArray(TEST_ARRAY)
    result = pd.Series(v)
    assert result.dtype == v.dtype
    assert isinstance(result._data.blocks[0], ExtensionBlock) 
开发者ID:xhochy,项目名称:fletcher,代码行数:7,代码来源:test_pandas_integration.py

示例6: test_series_constructor

# 需要导入模块: from pandas.core import internals [as 别名]
# 或者: from pandas.core.internals import ExtensionBlock [as 别名]
def test_series_constructor():
    v = ip.IPArray.from_pyints([1, 2, 3])
    result = pd.Series(v)
    assert result.dtype == v.dtype
    assert isinstance(result._data.blocks[0], ExtensionBlock) 
开发者ID:ContinuumIO,项目名称:cyberpandas,代码行数:7,代码来源:test_ip_pandas.py


注:本文中的pandas.core.internals.ExtensionBlock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。