Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.22.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ Removal of prior version deprecations/changes
- ``pd.ordered_merge`` has been removed (deprecated since v0.19). Use ``pd.merge_ordered`` instead (:issue:`18459`)
- The ``SparseList`` class has been removed (:issue:`14007`)
- The ``pandas.io.wb`` and ``pandas.io.data`` stub modules have been removed (:issue:`13735`)
- ``Categorical.from_array`` has been removed (:issue:`13854`)

.. _whatsnew_0220.performance:

Expand Down
20 changes: 0 additions & 20 deletions pandas/core/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,26 +552,6 @@ def _from_inferred_categories(cls, inferred_categories, inferred_codes,

return cls(codes, dtype=dtype, fastpath=True)

@classmethod
def from_array(cls, data, **kwargs):
"""
.. deprecated:: 0.19.0
Use ``Categorical`` instead.

Make a Categorical type from a single array-like object.

For internal compatibility with numpy arrays.

Parameters
----------
data : array-like
Can be an Index or array-like. The categories are assumed to be
the unique values of `data`.
"""
warn("Categorical.from_array is deprecated, use Categorical instead",
FutureWarning, stacklevel=2)
return cls(data, **kwargs)

@classmethod
def from_codes(cls, codes, categories, ordered=False):
"""
Expand Down
7 changes: 1 addition & 6 deletions pandas/tests/test_categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -1955,11 +1955,6 @@ def test_deprecated_labels(self):
res = cat.labels
tm.assert_numpy_array_equal(res, exp)

def test_deprecated_from_array(self):
# GH13854, `.from_array` is deprecated
with tm.assert_produces_warning(FutureWarning):
Categorical.from_array([0, 1])

def test_datetime_categorical_comparison(self):
dt_cat = Categorical(date_range('2014-01-01', periods=3), ordered=True)
tm.assert_numpy_array_equal(dt_cat > dt_cat[0],
Expand Down Expand Up @@ -4817,7 +4812,7 @@ def test_constructor(self):
assert isinstance(sc, tm.SubclassedCategorical)
tm.assert_categorical_equal(sc, Categorical(['a', 'b', 'c']))

def test_from_array(self):
def test_from_codes(self):
sc = tm.SubclassedCategorical.from_codes([1, 0, 2], ['a', 'b', 'c'])
assert isinstance(sc, tm.SubclassedCategorical)
exp = Categorical.from_codes([1, 0, 2], ['a', 'b', 'c'])
Expand Down