We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 65a48e1 commit 0627217Copy full SHA for 0627217
pandas/core/dtypes/cast.py
@@ -1225,7 +1225,7 @@ def maybe_cast_to_datetime(
1225
_ensure_nanosecond_dtype(dtype)
1226
1227
if lib.is_np_dtype(dtype, "m"):
1228
- if getattr(value, "ndim", 1) == 2 and value.shape[1] == 1:
+ if isinstance(value, np.ndarray) and value.ndim == 2 and value.shape[1] == 1:
1229
res = TimedeltaArray._from_sequence(value.ravel(), dtype=dtype)
1230
return res.reshape(value.shape)
1231
res = TimedeltaArray._from_sequence(value, dtype=dtype)
0 commit comments