diff --git a/pandas/core/dtypes/cast.py b/pandas/core/dtypes/cast.py index 19d3792f73de7..1292ca8cbf193 100644 --- a/pandas/core/dtypes/cast.py +++ b/pandas/core/dtypes/cast.py @@ -827,7 +827,7 @@ def try_datetime(v): except: pass - return v.reshape(shape) + return v def try_timedelta(v): # safe coerce to timedelta64 @@ -835,7 +835,7 @@ def try_timedelta(v): # will try first with a string & object conversion from pandas import to_timedelta try: - return to_timedelta(v)._values.reshape(shape) + return to_timedelta(v)._values. except: return v @@ -862,7 +862,7 @@ def try_timedelta(v): if lib.infer_dtype(value) in ['mixed']: value = try_datetime(v) - return value + return value.reshape(shape) def maybe_cast_to_datetime(value, dtype, errors='raise'):