diff --git a/pandas/core/config_init.py b/pandas/core/config_init.py index 3e753aacf7c71..875ab8249f953 100644 --- a/pandas/core/config_init.py +++ b/pandas/core/config_init.py @@ -412,8 +412,11 @@ def use_inf_as_na_cb(key): _use_inf_as_na(key) -cf.register_option('mode.use_inf_as_na', False, use_inf_as_na_doc, - cb=use_inf_as_na_cb) +with cf.config_prefix('mode'): + cf.register_option('use_inf_as_na', False, use_inf_as_na_doc, + cb=use_inf_as_na_cb) + cf.register_option('use_inf_as_null', False, use_inf_as_null_doc, + cb=use_inf_as_na_cb) cf.deprecate_option('mode.use_inf_as_null', msg=use_inf_as_null_doc, rkey='mode.use_inf_as_na') diff --git a/pandas/tests/series/test_missing.py b/pandas/tests/series/test_missing.py index 2d20ac9685914..01bf7274fd384 100644 --- a/pandas/tests/series/test_missing.py +++ b/pandas/tests/series/test_missing.py @@ -410,6 +410,22 @@ def test_isna_for_inf(self): tm.assert_series_equal(r, e) tm.assert_series_equal(dr, de) + @tm.capture_stdout + def test_isnull_for_inf_deprecated(self): + # gh-17115 + s = Series(['a', np.inf, np.nan, 1.0]) + with tm.assert_produces_warning(DeprecationWarning, + check_stacklevel=False): + pd.set_option('mode.use_inf_as_null', True) + r = s.isna() + dr = s.dropna() + pd.reset_option('mode.use_inf_as_null') + + e = Series([False, True, True, False]) + de = Series(['a', 1.0], index=[0, 3]) + tm.assert_series_equal(r, e) + tm.assert_series_equal(dr, de) + def test_fillna(self): ts = Series([0., 1., 2., 3., 4.], index=tm.makeDateIndex(5))