Skip to content

Commit 346510e

Browse files
committed
change according to comments
1 parent 51d363a commit 346510e

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

pandas/core/dtypes/dtypes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def _from_values_or_dtype(cls, values=None, categories=None, ordered=None,
272272
ordered : bool, optional
273273
Designating if the categories are ordered.
274274
dtype : CategoricalDtype or the string "category", optional
275-
If ``CategoricalDtype`` cannot be used together with
275+
If ``CategoricalDtype``, cannot be used together with
276276
`categories` or `ordered`.
277277
278278
Returns
@@ -294,7 +294,7 @@ def _from_values_or_dtype(cls, values=None, categories=None, ordered=None,
294294
ValueError: Cannot specify `categories` or `ordered` together with
295295
`dtype`.
296296
297-
The supplied dtype takes precedence over values's dtype:
297+
The supplied dtype takes precedence over values' dtype:
298298
299299
>>> CategoricalDtype._from_values_or_dtype(c, dtype=dtype2)
300300
CategoricalDtype(['x', 'y'], ordered=False)
@@ -493,7 +493,7 @@ def validate_categories(categories, fastpath=False):
493493
"""
494494
from pandas import Index
495495

496-
if not fastpath and not is_list_like(categories, allow_sets=True):
496+
if not fastpath and not is_list_like(categories):
497497
msg = "Parameter 'categories' must be list-like, was {!r}"
498498
raise TypeError(msg.format(categories))
499499
elif not isinstance(categories, ABCIndexClass):

pandas/tests/dtypes/test_dtypes.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def test_constructor_invalid(self):
106106
[c, None, None, dtype2, dtype2],
107107
[c, ['x', 'y'], False, None, dtype2],
108108
])
109-
def test_create_categorical_dtype(
109+
def test_from_values_or_dtype(
110110
self, values, categories, ordered, dtype, expected):
111111
result = CategoricalDtype._from_values_or_dtype(values, categories,
112112
ordered, dtype)
@@ -117,11 +117,9 @@ def test_create_categorical_dtype(
117117
[None, ['a', 'b'], None, dtype2],
118118
[None, None, True, dtype2],
119119
])
120-
def test_create_categorical_dtype_raises(self, values, categories,
121-
ordered,
122-
dtype):
120+
def test_from_values_or_dtype_raises(self, values, categories,
121+
ordered, dtype):
123122
msg = "Cannot specify `categories` or `ordered` together with `dtype`."
124-
125123
with pytest.raises(ValueError, match=msg):
126124
CategoricalDtype._from_values_or_dtype(values, categories,
127125
ordered, dtype)

0 commit comments

Comments
 (0)