Skip to content

Commit 84ee765

Browse files
BUG: Added 'O' to valid dtype list for pandas_dtype
1 parent 9e4adf7 commit 84ee765

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pandas/core/dtypes/common.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ def pandas_dtype(dtype):
748748
# also catch some valid dtypes such as object, np.object_ and 'object'
749749
# which we safeguard against by catching them earlier and returning
750750
# np.dtype(valid_dtype) before this condition is evaluated.
751-
if dtype in [object, np.object_, 'object']:
751+
if dtype in [object, np.object_, 'object', 'O']:
752752
return npdtype
753753
elif npdtype.kind == 'O':
754754
raise TypeError('dtype {0} not understood'.format(dtype))

pandas/tests/dtypes/test_common.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def test_invalid_dtype_error(self):
2323
with tm.assertRaisesRegexp(TypeError, msg):
2424
pandas_dtype(dtype)
2525

26-
valid_list = [object, 'float64', np.object_, np.dtype('object'),
26+
valid_list = [object, 'float64', np.object_, np.dtype('object'), 'O',
2727
np.float64, float, np.dtype('float64')]
2828
for dtype in valid_list:
2929
pandas_dtype(dtype)

0 commit comments

Comments
 (0)