Skip to content

Commit f008c38

Browse files
committed
Fixed asarray
1 parent 62326ae commit f008c38

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

pandas/core/internals/managers.py

+5
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,11 @@ def _interleave(self):
791791
"""
792792
dtype = _interleaved_dtype(self.blocks)
793793

794+
if is_extension_array_dtype(dtype):
795+
# TODO: https://github.com/pandas-dev/pandas/issues/22791
796+
# Give EAs some input on what happens here. Sparse needs this.
797+
dtype = 'object'
798+
794799
result = np.empty(self.shape, dtype=dtype)
795800

796801
if result.shape[0] == 0:

pandas/tests/frame/test_dtypes.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,8 @@ def test_asarray_homogenous(self):
843843
df = pd.DataFrame({"A": pd.Categorical([1, 2]),
844844
"B": pd.Categorical([1, 2])})
845845
result = np.asarray(df)
846-
expected = np.array([[1, 1], [2, 2,]])
846+
# may change from object in the future
847+
expected = np.array([[1, 1], [2, 2,]], dtype='object')
847848
tm.assert_numpy_array_equal(result, expected)
848849

849850

0 commit comments

Comments
 (0)