Skip to content

Commit

Permalink
COMPAT: make sure use_inf_as_null is deprecated
Browse files Browse the repository at this point in the history
closes #17115
  • Loading branch information
jreback committed Jul 31, 2017
1 parent f2b0bdc commit 6a7e022
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pandas/core/config_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
11 changes: 11 additions & 0 deletions pandas/tests/series/test_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,17 @@ def test_isna_for_inf(self):
tm.assert_series_equal(r, e)
tm.assert_series_equal(dr, de)

def test_isnull_for_inf_deprecated(self):
# gh-17115
s = Series(['a', np.inf, np.nan, 1.0])
with pd.option_context('mode.use_inf_as_null', True):
r = s.isna()
dr = s.dropna()
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))

Expand Down

0 comments on commit 6a7e022

Please sign in to comment.