Skip to content

Commit aad3846

Browse files
committed
DEPR: pandas.types.concat.union_categoricals in favor of pandas.api.type.union_categoricals
closes pandas-dev#16140
1 parent 049be52 commit aad3846

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

pandas/tests/api/test_api.py

+14
Original file line numberDiff line numberDiff line change
@@ -217,3 +217,17 @@ class TestTSLib(tm.TestCase):
217217
def test_deprecation_access_func(self):
218218
with catch_warnings(record=True):
219219
pd.tslib.Timestamp('20160101')
220+
221+
222+
class TestTypes(tm.TestCase):
223+
224+
def test_deprecation_access_func(self):
225+
with tm.assert_produces_warning(
226+
FutureWarning, check_stacklevel=False):
227+
from pandas.types.concat import union_categoricals
228+
c1 = pd.Categorical(list('aabc'))
229+
c2 = pd.Categorical(list('abcd'))
230+
union_categoricals(
231+
[c1, c2],
232+
sort_categories=True,
233+
ignore_order=True)

pandas/types/__init__.py

Whitespace-only changes.

pandas/types/concat.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import warnings
2+
3+
4+
def union_categoricals(to_union, sort_categories=False, ignore_order=False):
5+
warnings.warn("pandas.types.concat.union_categoricals is "
6+
"deprecated and will be removed in a future version.\n"
7+
"use pandas.api.types.union_categoricals",
8+
FutureWarning, stacklevel=2)
9+
from pandas.api.types import union_categoricals
10+
return union_categoricals(
11+
to_union, sort_categories=sort_categories, ignore_order=ignore_order)

0 commit comments

Comments
 (0)