Skip to content

Commit d24fb34

Browse files
committed
COMPAT: silence mpl_style warnings
closes #12311 closes #12315 WARN: remove warnings from categorical tests with .str.extract
1 parent dc6c678 commit d24fb34

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

pandas/core/config.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,11 @@ def _set_option(*args, **kwargs):
127127
root[k] = v
128128

129129
if o.cb:
130-
o.cb(key)
130+
if silent:
131+
with warnings.catch_warnings(record=True):
132+
o.cb(key)
133+
else:
134+
o.cb(key)
131135

132136

133137
def _describe_option(pat='', _print_desc=True):

pandas/core/config_init.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@
253253

254254
def mpl_style_cb(key):
255255
warnings.warn(pc_mpl_style_deprecation_warning, FutureWarning,
256-
stacklevel=4)
256+
stacklevel=5)
257257

258258
import sys
259259
from pandas.tools.plotting import mpl_stylesheet

pandas/tests/test_categorical.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -4109,7 +4109,8 @@ def test_str_accessor_api_for_categorical(self):
41094109
('decode', ("UTF-8",), {}),
41104110
('encode', ("UTF-8",), {}),
41114111
('endswith', ("a",), {}),
4112-
('extract', ("([a-z]*) ",), {}),
4112+
('extract', ("([a-z]*) ",), {"expand":False}),
4113+
('extract', ("([a-z]*) ",), {"expand":True}),
41134114
('extractall', ("([a-z]*) ",), {}),
41144115
('find', ("a",), {}),
41154116
('findall', ("a",), {}),

0 commit comments

Comments
 (0)