-
-
Notifications
You must be signed in to change notification settings - Fork 19.8k
Should SparseArray.astype be dense or Sparse #23125
Copy link
Copy link
Closed
Labels
API DesignBlockerBlocking issue or pull request for an upcoming releaseBlocking issue or pull request for an upcoming releaseDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsSparseSparse Data TypeSparse Data Type
Milestone
Description
Right now SparseArray.astype(numpy_dtype) is sparse:
In [6]: a = pd.SparseArray([0, 1, 0, 1])
In [7]: a.astype(np.dtype('float'))
Out[7]:
[0, 1.0, 0, 1.0]
Fill: 0
IntIndex
Indices: array([1, 3], dtype=int32)This is potentially confusing. I did it to match the behavior of SparseSeries, but we may not want that.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
API DesignBlockerBlocking issue or pull request for an upcoming releaseBlocking issue or pull request for an upcoming releaseDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsSparseSparse Data TypeSparse Data Type