-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN: clean-up internal sparse imports + restructure sparse submodule #28516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLN: clean-up internal sparse imports + restructure sparse submodule #28516
Conversation
Thanks! I had two other followup items:
Do you want to do those here?
Either doing it now, or as part of a larger |
Does scipy_sparse belong in core.arrays? I've been thinking that SparseAccessor might not belong in the array file, could go in core.sparse |
How about making
|
It is correct that the accessor (which also is a DataFrame accessor) is not directly related to arrays, and more something on the "dataframe level". But since we do not have a proper home right now for such functionality, I think keeping the type-specific accessors close to their type implementations (array / dtype) makes somewhat sense. Given that, having a sparse directory with several files seems fine to me. |
FWIW, I slightly prefer having the accessor close to the array implementation. This more closely mirrors what 3rd party EA authors would do. |
This isn't a particularly big deal, but I want to make sure my reasoning is written down somewhere: For the most part, a reader can understand In the case of |
@jbrockmendel and is the alternative that you prefer having a For having it in arrays/sparse, the only additional thing that it relies upon from the rest of core is |
At the time I formed this preference, sparse.frame and sparse.series still existed, so moving to sparse.accessor was my preferred alternative. Haven't thought about an updated preference.
There are runtime imports of DataFrame, Series, Index. |
Done
Went ahead with that then. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. merge when ready.
lgtm |
Updating our internal imports to use the path were they actually live, not the old
core.sparse.api
one.While doing this, I was thinking now that for the tests, we could actually also use the top-level
pd.
imports.@TomAugspurger in the
core/sparse/
module, the only actual code living there is the scipy_sparse code. I moved that toarrays
module (but could also be moved within the sparse.py file, or create a sparse subdirectory, ..).Do we want to raise a deprecation warning on pandas.core.sparse.api?