Skip to content

Commit

Permalink
DEPR: add deprecation warning for com.array_equivalent
Browse files Browse the repository at this point in the history
pandas.core.common.array_equivalent was removed without deprecation warning.
This commits adds it back to the core.common namespace with deprecation warning
  • Loading branch information
jorisvandenbossche committed Nov 2, 2016
1 parent 1d95179 commit 4b7d360
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pandas/api/tests/test_api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-

import numpy as np

import pandas as pd
from pandas.core import common as com
from pandas import api
Expand Down Expand Up @@ -181,9 +183,14 @@ def test_deprecation_core_common(self):

# test that we are in fact deprecating
# the pandas.core.common introspectors
for t in self.allowed:
for t in (self.allowed + ['array_equivalent']):
self.check_deprecation(getattr(com, t), getattr(types, t))

def test_deprecation_core_common_array_equivalent(self):

with tm.assert_produces_warning(DeprecationWarning):
com.array_equivalent(np.array([1, 2]), np.array([1, 2]))

def test_deprecation_core_common_moved(self):

# these are in pandas.types.common
Expand Down
10 changes: 10 additions & 0 deletions pandas/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from pandas.types.missing import isnull
from pandas.api import types
from pandas.types import common
from pandas.util.decorators import deprecate

# back-compat of public API
# deprecate these functions
Expand Down Expand Up @@ -64,6 +65,15 @@ def wrapper(*args, **kwargs):
setattr(m, t, outer(t))


# deprecate array_equivalent

def array_equivalent(*args, **kwargs):
warnings.warn("'pandas.core.common.array_equivalent' is deprecated and "
"is no longer public API", DeprecationWarning, stacklevel=2)
from pandas.types import missing
return missing.array_equivalent(*args, **kwargs)


class PandasError(Exception):
pass

Expand Down

0 comments on commit 4b7d360

Please sign in to comment.