From d11f17afcfc829c55de2317c4f08910bda25e745 Mon Sep 17 00:00:00 2001 From: gfyoung Date: Thu, 22 Jun 2017 21:53:35 -0700 Subject: [PATCH] MAINT: Drop pd.options.display.mpl_style Deprecated in 0.18.0 xref gh-12190 --- doc/source/whatsnew/v0.21.0.txt | 1 + pandas/core/config_init.py | 32 ----------------------------- pandas/tests/plotting/test_frame.py | 14 ------------- 3 files changed, 1 insertion(+), 46 deletions(-) diff --git a/doc/source/whatsnew/v0.21.0.txt b/doc/source/whatsnew/v0.21.0.txt index 9d330cf3fdf2d..028f9884ead55 100644 --- a/doc/source/whatsnew/v0.21.0.txt +++ b/doc/source/whatsnew/v0.21.0.txt @@ -75,6 +75,7 @@ Removal of prior version deprecations/changes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - :func:`read_excel()` has dropped the ``has_index_names`` parameter (:issue:`10967`) +- The ``pd.options.display.mpl_style`` configuration has been dropped (:issue:`12190`) - ``Categorical`` has dropped the ``.order()`` and ``.sort()`` methods in favor of ``.sort_values()`` (:issue:`12882`) diff --git a/pandas/core/config_init.py b/pandas/core/config_init.py index 7e6ffaaffb72b..e70db1d13e376 100644 --- a/pandas/core/config_init.py +++ b/pandas/core/config_init.py @@ -9,8 +9,6 @@ module is imported, register them here rather then in the module. """ -import warnings - import pandas.core.config as cf from pandas.core.config import (is_int, is_bool, is_text, is_instance_factory, is_one_of_factory, get_default_val, @@ -313,33 +311,6 @@ def use_numexpr_cb(key): style_backup = dict() -def mpl_style_cb(key): - warnings.warn(pc_mpl_style_deprecation_warning, FutureWarning, - stacklevel=5) - - import sys - from pandas.plotting._style import mpl_stylesheet - global style_backup - - val = cf.get_option(key) - - if 'matplotlib' not in sys.modules.keys(): - if not val: # starting up, we get reset to None - return val - raise Exception("matplotlib has not been imported. aborting") - - import matplotlib.pyplot as plt - - if val == 'default': - style_backup = dict([(k, plt.rcParams[k]) for k in mpl_stylesheet]) - plt.rcParams.update(mpl_stylesheet) - elif not val: - if style_backup: - plt.rcParams.update(style_backup) - - return val - - def table_schema_cb(key): from pandas.io.formats.printing import _enable_data_resource_formatter _enable_data_resource_formatter(cf.get_option(key)) @@ -382,9 +353,6 @@ def table_schema_cb(key): validator=is_one_of_factory([True, False, 'truncate'])) cf.register_option('chop_threshold', None, pc_chop_threshold_doc) cf.register_option('max_seq_items', 100, pc_max_seq_items) - cf.register_option('mpl_style', None, pc_mpl_style_doc, - validator=is_one_of_factory([None, False, 'default']), - cb=mpl_style_cb) cf.register_option('height', 60, pc_height_doc, validator=is_instance_factory([type(None), int])) cf.register_option('width', 80, pc_width_doc, diff --git a/pandas/tests/plotting/test_frame.py b/pandas/tests/plotting/test_frame.py index fc9ef132b2754..dfe953f7116c4 100644 --- a/pandas/tests/plotting/test_frame.py +++ b/pandas/tests/plotting/test_frame.py @@ -2682,20 +2682,6 @@ def test_df_grid_settings(self): DataFrame({'a': [1, 2, 3], 'b': [2, 3, 4]}), plotting._core._dataframe_kinds, kws={'x': 'a', 'y': 'b'}) - def test_option_mpl_style(self): - with tm.assert_produces_warning(FutureWarning, - check_stacklevel=False): - set_option('display.mpl_style', 'default') - with tm.assert_produces_warning(FutureWarning, - check_stacklevel=False): - set_option('display.mpl_style', None) - with tm.assert_produces_warning(FutureWarning, - check_stacklevel=False): - set_option('display.mpl_style', False) - - with pytest.raises(ValueError): - set_option('display.mpl_style', 'default2') - def test_invalid_colormap(self): df = DataFrame(randn(3, 2), columns=['A', 'B'])