BUG: to_datetime with xarray DataArray and specifie unit errors (#44074) · pandas-dev/pandas@3a6d4cd (original) (raw)

Original file line number Diff line number Diff line change
@@ -325,7 +325,6 @@ def _convert_listlike_datetimes(
325 325 -------
326 326 Index-like of parsed dates
327 327 """
328 -
329 328 if isinstance(arg, (list, tuple)):
330 329 arg = np.array(arg, dtype="O")
331 330
@@ -525,6 +524,7 @@ def _to_datetime_with_unit(arg, unit, name, tz, errors: str) -> Index:
525 524 arr = arg.astype(f"datetime64[{unit}]")
526 525 tz_parsed = None
527 526 else:
527 +arg = np.asarray(arg)
528 528 arr, tz_parsed = tslib.array_with_unit_to_datetime(arg, unit, errors=errors)
529 529
530 530 if errors == "ignore":