-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
DEPR: rename to _consolidate and create deprecation warning #15501
DEPR: rename to _consolidate and create deprecation warning #15501
Conversation
@GuessWhoSamFoo We would like to have it the other way around. Have the deprecation warning in |
The original |
pandas/io/pytables.py
Outdated
@@ -2861,7 +2861,7 @@ def write(self, obj, **kwargs): | |||
super(BlockManagerFixed, self).write(obj, **kwargs) | |||
data = obj._data | |||
if not data.is_consolidated(): | |||
data = data.consolidate() | |||
data = data._consolidate() |
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.
Here, data
is not a DataFrame, but a BlockManager, so this should be left as consolidate
(that's the reason for the test failures)
doc/source/whatsnew/v0.20.0.txt
Outdated
@@ -484,6 +484,7 @@ Deprecations | |||
- ``DataFrame.astype()`` has deprecated the ``raise_on_error`` parameter in favor of ``errors`` (:issue:`14878`) | |||
- ``Series.sortlevel`` and ``DataFrame.sortlevel`` have been deprecated in favor of ``Series.sort_index`` and ``DataFrame.sort_index`` (:issue:`15099`) | |||
- importing ``concat`` from ``pandas.tools.merge`` has been deprecated in favor of imports from the ``pandas`` namespace. This should only affect explict imports (:issue:`15358`) | |||
- ``DataFrame.consolidate()`` has been deprecated. (:issue:`15483`) |
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.
say Series/DataFrame/Panel.consolidate()
it affects everything
say has been deprecated as a public method as
pandas/core/generic.py
Outdated
""" | ||
DEPRECATED: |
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.
this is not deprecated though.
can you add a doc-string
pandas/core/generic.py
Outdated
@@ -2897,6 +2898,12 @@ def consolidate(self, inplace=False): | |||
cons_data = self._protect_consolidate(f) | |||
return self._constructor(cons_data).__finalize__(self) | |||
|
|||
def consolidate(self, inplace=False): | |||
# 15483 |
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.
here is where the DEPRECATED goes (in the doc-string)
@@ -40,17 +40,17 @@ def test_cast_internals(self): | |||
|
|||
def test_consolidate(self): |
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.
can you add a single test (test_consolidate_deprecation), which uses assert_produces_warning(FutureWarning)
pandas/core/generic.py
Outdated
def consolidate(self, inplace=False): | ||
# 15483 | ||
warnings.warn("consolidate is deprecated and will be removed in a " | ||
"future release.", DeprecationWarning) |
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.
use FutureWarning
Changed internal references to consolidate and updated tests Updated per review comments
ee3ec7a
to
4e927e6
Compare
Squashed the last two commits with the changes from the feedback. Thank you for the guidance! |
Codecov Report
@@ Coverage Diff @@
## master #15501 +/- ##
==========================================
+ Coverage 90.36% 91.08% +0.71%
==========================================
Files 136 136
Lines 49552 49102 -450
==========================================
- Hits 44780 44725 -55
+ Misses 4772 4377 -395
Continue to review full report at Codecov.
|
@GuessWhoSamFoo Thank you! |
git diff upstream/master | flake8 --diff
Test output: