-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
DEPR: Deprecate Series/Dataframe.to_dense/to_sparse #26684
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
Changes from 4 commits
a71737c
fc08e93
82c713d
39230d4
1e7c0e8
e68826c
20b8962
50d0534
933162d
dd1e6c2
c7f27fd
be14520
b12e447
2d4de51
eede9b8
0b08795
5182a1f
15909c5
104c12a
e713fb0
587b14f
1318676
9043e03
58c678a
ca14ac1
0c8f287
871ccff
a8f6c56
72aaca5
6a6e333
4e67856
4a3181b
a546a89
5fdb2f8
a627828
3d36430
9f888c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1887,6 +1887,8 @@ def from_csv(cls, path, header=0, sep=',', index_col=0, parse_dates=True, | |
|
||
def to_sparse(self, fill_value=None, kind='block'): | ||
""" | ||
..deprecated:: 0.25.0 | ||
|
||
Convert to SparseDataFrame. | ||
|
||
Implement the sparse version of the DataFrame meaning that any data | ||
|
@@ -1939,6 +1941,11 @@ def to_sparse(self, fill_value=None, kind='block'): | |
>>> type(sdf) # doctest: +SKIP | ||
<class 'pandas.core.sparse.frame.SparseDataFrame'> | ||
""" | ||
warning_message = """\ | ||
VikramjeetD marked this conversation as resolved.
Show resolved
Hide resolved
|
||
to_sparse is deprecated and will be removed in a future version | ||
""" | ||
warnings.warn(warning_message, FutureWarning, stacklevel=2) | ||
|
||
from pandas.core.sparse.api import SparseDataFrame | ||
return SparseDataFrame(self._series, index=self.index, | ||
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. wont' this also trigger the SDF warnings? (should this just be changed to create a DF here? 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. Do you mean the SDF deprecation warning? If thats the case, yes, but this was requested in the issue that this PR will address ( #26557 ). 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. Yes, it already triggers the SparseDataFrame warning. But, it is still good to explicitly deprecate this method as well (in the docs, and by giving a clearer warning message, although the other one will also still be present). I don't think we should change the behaviour, since we are deprecating it (it would also be a backwards incompatible change, as DataFrame with sparse and SparseDataFrame are not fully interchangeable). 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. So I think we can agree to keep both the warnings and resolve this conversation? 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. actually i would suppress the SDF |
||
columns=self.columns, default_kind=kind, | ||
|
Uh oh!
There was an error while loading. Please reload this page.