Skip to content

Commit

Permalink
COMPAT: Add back remove_na for seaborn
Browse files Browse the repository at this point in the history
Closes gh-16971.
  • Loading branch information
gfyoung committed Jul 17, 2017
1 parent ea487fc commit 26c2cad
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
15 changes: 15 additions & 0 deletions pandas/core/dtypes/missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
missing types & inference
"""
import numpy as np
import warnings

from pandas._libs import lib
from pandas._libs.tslib import NaT, iNaT
from .generic import (ABCMultiIndex, ABCSeries,
Expand Down Expand Up @@ -401,3 +403,16 @@ def remove_na_arraylike(arr):
Return array-like containing only true/non-NaN values, possibly empty.
"""
return arr[notnull(lib.values_from_object(arr))]


# see gh-16971
def remove_na(arr):
"""
DEPRECATED : this function will be removed in a future version.
Alias to `remove_na_arraylike` for `seaborn` compatibility.
"""

warnings.warn("remove_na is deprecated. Use remove_na_arraylike instead.",
FutureWarning, stacklevel=2)
return remove_na_arraylike(arr)
3 changes: 3 additions & 0 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
maybe_cast_to_datetime, maybe_castable)
from pandas.core.dtypes.missing import isnull, notnull, remove_na_arraylike

# see gh-16971
from pandas.core.dtypes.missing import remove_na # noqa

from pandas.core.common import (is_bool_indexer,
_default_index,
_asarray_tuplesafe,
Expand Down
8 changes: 7 additions & 1 deletion pandas/tests/dtypes/test_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@
from pandas.core.dtypes.dtypes import DatetimeTZDtype
from pandas.core.dtypes.missing import (
array_equivalent, isnull, notnull,
na_value_for_dtype)
na_value_for_dtype, remove_na)


def test_remove_na_deprecation():
# see gh-16971
with tm.assert_produces_warning(FutureWarning):
remove_na(Series([]))


def test_notnull():
Expand Down

0 comments on commit 26c2cad

Please sign in to comment.