-
-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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/API: move plotting funcs to pandas.plotting #16005
Changes from 11 commits
94fe3e1
1fba0c6
859ad24
ea757d4
b5328a2
a1f272a
c6452b3
d4bdb0a
72ffe97
09291e2
468313a
7f895cb
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 |
---|---|---|
|
@@ -21,6 +21,7 @@ Highlights include: | |
- Support for S3 handling now uses ``s3fs``, see :ref:`here <whatsnew_0200.api_breaking.s3>` | ||
- Google BigQuery support now uses the ``pandas-gbq`` library, see :ref:`here <whatsnew_0200.api_breaking.gbq>` | ||
- Switched the test framework to use `pytest <http://doc.pytest.org/en/latest>`__ (:issue:`13097`) | ||
- The ``pandas.tools.plotting`` module has been deprecated, moved to ``pandas.plotting``. See :ref:`here <whatsnew_0200.api_breaking.plotting>` (:issue:`12548`) | ||
|
||
|
||
Check the :ref:`API Changes <whatsnew_0200.api_breaking>` and :ref:`deprecations <whatsnew_0200.deprecations>` before updating. | ||
|
@@ -557,6 +558,31 @@ Using ``.iloc``. Here we will get the location of the 'A' column, then use *posi | |
df.iloc[[0, 2], df.columns.get_loc('A')] | ||
|
||
|
||
.. _whatsnew_0200.api_breaking.deprecate_plotting | ||
|
||
Deprecate .plotting | ||
^^^^^^^^^^^^^^^^^^^ | ||
|
||
The ``pandas.tools.plotting`` module has been deprecated, in favor of the top level ``pandas.plotting`` module. All the public plotting functions are now available | ||
from ``pandas.plotting``. | ||
|
||
Further, the top-level ``pandas.scatter_matrix`` and ``pandas.plot_params`` are also deprecated. | ||
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. Furthermore 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. are deprecated (also is redundant) |
||
Users can import these from ``pandas.plotting`` as well. | ||
|
||
Previous script: | ||
|
||
.. code-block:: python | ||
|
||
pd.tools.plotting.scatter_matrix(df) | ||
pd.scatter_matrix(df) | ||
|
||
Should be changed to: | ||
|
||
.. code-block:: python | ||
|
||
pd.plotting.scatter_matrix(df) | ||
|
||
|
||
.. _whatsnew_0200.api_breaking.deprecate_panel: | ||
|
||
Deprecate Panel | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,7 +49,15 @@ | |
from pandas.tools.merge import (merge, ordered_merge, | ||
merge_ordered, merge_asof) | ||
from pandas.tools.pivot import pivot_table, crosstab | ||
from pandas.tools.plotting import scatter_matrix, plot_params | ||
|
||
# deprecate tools.plotting, plot_params and scatter_matrix on the top namespace | ||
import pandas.tools.plotting | ||
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. ideally this could actually be done in 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. I think this line is just to make sure 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. yeah its probably fine. also need to move these in the test_api to the deprecated section. (also add on to the deprecated issue tracker) 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. there are test for that in added to #6581 |
||
plot_params = pandas.plotting._style._Options(deprecated=True) | ||
# do not import deprecate to top namespace | ||
scatter_matrix = pandas.util.decorators.deprecate( | ||
'pandas.scatter_matrix', pandas.plotting.scatter_matrix, | ||
'pandas.plotting.scatter_matrix') | ||
|
||
from pandas.tools.tile import cut, qcut | ||
from pandas.tools.util import to_numeric | ||
from pandas.core.reshape import melt | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
""" | ||
Plotting api | ||
""" | ||
|
||
# flake8: noqa | ||
|
||
try: # mpl optional | ||
from pandas.plotting import _converter | ||
_converter.register() # needs to override so set_xlim works with str/number | ||
except ImportError: | ||
pass | ||
|
||
from pandas.plotting._misc import (scatter_matrix, radviz, | ||
andrews_curves, bootstrap_plot, | ||
parallel_coordinates, lag_plot, | ||
autocorrelation_plot) | ||
from pandas.plotting._core import boxplot | ||
from pandas.plotting._style import plot_params | ||
from pandas.plotting._tools import table |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# being a bit too dynamic | ||
# pylint: disable=E1101 | ||
from __future__ import division | ||
|
||
from distutils.version import LooseVersion | ||
|
||
|
||
def _mpl_le_1_2_1(): | ||
try: | ||
import matplotlib as mpl | ||
return (str(mpl.__version__) <= LooseVersion('1.2.1') and | ||
str(mpl.__version__)[0] != '0') | ||
except ImportError: | ||
return False | ||
|
||
|
||
def _mpl_ge_1_3_1(): | ||
try: | ||
import matplotlib | ||
# The or v[0] == '0' is because their versioneer is | ||
# messed up on dev | ||
return (matplotlib.__version__ >= LooseVersion('1.3.1') or | ||
matplotlib.__version__[0] == '0') | ||
except ImportError: | ||
return False | ||
|
||
|
||
def _mpl_ge_1_4_0(): | ||
try: | ||
import matplotlib | ||
return (matplotlib.__version__ >= LooseVersion('1.4') or | ||
matplotlib.__version__[0] == '0') | ||
except ImportError: | ||
return False | ||
|
||
|
||
def _mpl_ge_1_5_0(): | ||
try: | ||
import matplotlib | ||
return (matplotlib.__version__ >= LooseVersion('1.5') or | ||
matplotlib.__version__[0] == '0') | ||
except ImportError: | ||
return False | ||
|
||
|
||
def _mpl_ge_2_0_0(): | ||
try: | ||
import matplotlib | ||
return matplotlib.__version__ >= LooseVersion('2.0') | ||
except ImportError: | ||
return False | ||
|
||
|
||
def _mpl_ge_2_0_1(): | ||
try: | ||
import matplotlib | ||
return matplotlib.__version__ >= LooseVersion('2.0.1') | ||
except ImportError: | ||
return False |
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.
I would put the issue number in the sub-section