Skip to content

Commit 607ae9c

Browse files
authored
Update generic.py
1 parent 84bbeae commit 607ae9c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pandas/core/generic.py

+6
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ def _validate_dtype(self, dtype):
172172
raise NotImplementedError("compound dtypes are not implemented"
173173
"in the {0} constructor"
174174
.format(self.__class__.__name__))
175+
176+
# check if coerced dtype is of type object
177+
if dtype.kind == 'O':
178+
raise TypeError("argument 'dtype' must be a valid "
179+
"pandas/numpy dtype")
180+
175181
return dtype
176182

177183
def _init_mgr(self, mgr, axes=None, dtype=None, copy=False):

0 commit comments

Comments
 (0)