-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
API: Add sparse Acessor #23183
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
Merged
Merged
API: Add sparse Acessor #23183
Changes from 4 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
cb28dd2
API: Add sparse Acessor
TomAugspurger 9010045
whatsnew
TomAugspurger 5ef4f14
fixup
TomAugspurger 3e0e1f9
Regular autosummary for methods
TomAugspurger ede3f2e
Merge remote-tracking branch 'upstream/master' into sparse-accessor
TomAugspurger 1bcebe7
docs
TomAugspurger 688079b
Merge remote-tracking branch 'upstream/master' into sparse-accessor
TomAugspurger ad00f99
updates
TomAugspurger 62f6ecf
Remove from API.rst
TomAugspurger e26d48e
Merge remote-tracking branch 'upstream/master' into sparse-accessor
TomAugspurger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -427,14 +427,20 @@ changes were made: | |
- ``SparseDataFrame.combine`` and ``DataFrame.combine_first`` no longer supports combining a sparse column with a dense column while preserving the sparse subtype. The result will be an object-dtype SparseArray. | ||
- Setting :attr:`SparseArray.fill_value` to a fill value with a different dtype is now allowed. | ||
|
||
|
||
Some new warnings are issued for operations that require or are likely to materialize a large dense array: | ||
|
||
- A :class:`errors.PerformanceWarning` is issued when using fillna with a ``method``, as a dense array is constructed to create the filled array. Filling with a ``value`` is the efficient way to fill a sparse array. | ||
- A :class:`errors.PerformanceWarning` is now issued when concatenating sparse Series with differing fill values. The fill value from the first sparse array continues to be used. | ||
|
||
In addition to these API breaking changes, many :ref:`performance improvements and bug fixes have been made <whatsnew_0240.bug_fixes.sparse>`. | ||
|
||
Finally, a ``Series.sparse`` accessor has added to provide sparse-specific methods and attributes. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add link to docs There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't link to a generic
and people can navigate from there. |
||
|
||
.. ipython:: python | ||
|
||
s = pd.Series([0, 0, 1, 1, 1], dtype='Sparse[int]') | ||
s.sparse.density | ||
|
||
.. _whatsnew_0240.api_breaking.frame_to_dict_index_orient: | ||
|
||
Raise ValueError in ``DataFrame.to_dict(orient='index')`` | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
""" | ||
datetimelike delegation | ||
""" | ||
|
||
import numpy as np | ||
|
||
from pandas.core.dtypes.generic import ABCSeries | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.