Skip to content

Commit 6f65134

Browse files
jrebackcbertinato
authored andcommitted
revert changes from master
1 parent e5423b7 commit 6f65134

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

pandas/core/series.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,11 @@ def __init__(self, data=None, index=None, dtype=None, name=None,
212212
'be False.')
213213

214214
elif is_extension_array_dtype(data) and dtype is not None:
215-
# GH12574: Allow dtype=category only, otherwise error
216-
if ((dtype is not None) and
217-
not is_categorical_dtype(dtype)):
218-
raise ValueError("cannot specify a dtype with a "
219-
"Categorical unless "
220-
"dtype='category'")
215+
if not data.dtype.is_dtype(dtype):
216+
raise ValueError("Cannot specify a dtype '{}' with an "
217+
"extension array of a different "
218+
"dtype ('{}').".format(dtype,
219+
data.dtype))
221220

222221
elif (isinstance(data, types.GeneratorType) or
223222
(compat.PY3 and isinstance(data, map))):

0 commit comments

Comments
 (0)