本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)
示例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)