Skip to content

Commit fe1a1d1

Browse files
committed
reshape the array back after maybe_infer_to_datetimelike
1 parent c967d6b commit fe1a1d1

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pandas/core/construction.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -612,10 +612,8 @@ def sanitize_array(
612612
if dtype is None:
613613
subarr = data
614614
if data.dtype == object and infer_object:
615-
# GH#61026
616-
if data.ndim != 1:
617-
subarr = subarr.ravel()
618-
subarr = maybe_infer_to_datetimelike(subarr)
615+
fltarr = data.ravel() # GH#61026
616+
subarr = maybe_infer_to_datetimelike(fltarr).reshape(data.shape)
619617
elif data.dtype.kind == "U" and using_string_dtype():
620618
from pandas.core.arrays.string_ import StringDtype
621619

0 commit comments

Comments
 (0)