-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Open
Labels
Dtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsEnhancementExtensionArrayExtending pandas with custom dtypes or arrays.Extending pandas with custom dtypes or arrays.
Description
This is coming out of SparseArray. Right now if you have a homogeneous DataFrame of EAs, then doing something like np.asarray(df)
will always convert to object.
pandas/pandas/core/internals/managers.py
Lines 787 to 794 in 32a74f1
def _interleave(self): | |
""" | |
Return ndarray from blocks with specified item order | |
Items must be contained in the blocks | |
""" | |
dtype = _interleaved_dtype(self.blocks) | |
result = np.empty(self.shape, dtype=dtype) |
Should we give ExtensionDtype some input on the dtype used here? This would allow for some consistency between np.asarray(series)
and np.asarray(homogeneous_dataframe)
.
Metadata
Metadata
Assignees
Labels
Dtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsEnhancementExtensionArrayExtending pandas with custom dtypes or arrays.Extending pandas with custom dtypes or arrays.