Skip to content

Commit bb25f3b

Browse files
committed
update
1 parent a1bffc3 commit bb25f3b

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

pandas/core/categorical.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ class Categorical(PandasObject):
223223
Categorical.order
224224
Categorical.min
225225
Categorical.max
226+
pandas.api.types.CategoricalDtype
226227
"""
227228

228229
# For comparisons, so that numpy uses our implementation if the compare

pandas/tests/dtypes/test_dtypes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,9 @@ def test_invalid_raises(self):
615615
with tm.assert_raises_regex(TypeError, 'ordered'):
616616
CategoricalDtype(['a', 'b'], ordered='foo')
617617

618+
with tm.assert_raises_regex(TypeError, 'collection'):
619+
CategoricalDtype('category')
620+
618621
def test_mixed(self):
619622
a = CategoricalDtype(['a', 'b', 1, 2])
620623
b = CategoricalDtype(['a', 'b', '1', '2'])

pandas/util/testing.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1244,9 +1244,11 @@ def assert_series_equal(left, right, check_dtype=True,
12441244
obj='{obj}.index'.format(obj=obj))
12451245

12461246
if check_dtype:
1247+
# We want to skip exact dtype checking when `check_categorical`
1248+
# is False. We'll still raise if only one is a `Categorical`,
1249+
# regardless of `check_categorical`
12471250
if (is_categorical_dtype(left) and is_categorical_dtype(right) and
12481251
not check_categorical):
1249-
# compat with pandas 0.21.0 CategoricalDtype
12501252
pass
12511253
else:
12521254
assert_attr_equal('dtype', left, right)

0 commit comments

Comments
 (0)