@@ -243,7 +243,8 @@ def to_datetime(arg, errors='raise', dayfirst=False, yearfirst=False,
243
243
method of parsing them. In some cases this can increase the parsing
244
244
speed by ~5-10x.
245
245
origin : scalar, default is 'unix'
246
- convertible to Timestamp / string ('julian', 'unix')
246
+ Define the reference date. The numeric values would be parsed as number
247
+ of units (defined by `unit`) since this reference date.
247
248
248
249
- If 'unix' (or POSIX) time; origin is set to 1970-01-01.
249
250
- If 'julian', unit must be 'D', and origin is set to beginning of
@@ -483,17 +484,12 @@ def _convert_listlike(arg, box, format, name=None, tz=tz):
483
484
# this should be lossless in terms of precision
484
485
offset = offset // tslib .Timedelta (1 , unit = unit )
485
486
486
- arg = np .asarray (arg )
487
+ # scalars & ndarray-like can handle the addition
488
+ if is_list_like (arg ) and not isinstance (
489
+ arg , (ABCSeries , ABCIndexClass , np .ndarray )):
490
+ arg = np .asarray (arg )
487
491
arg = arg + offset
488
492
489
- # convert to the tenor of the original arg
490
- if is_scalar (original ):
491
- arg = arg .item ()
492
- elif isinstance (original , ABCSeries ):
493
- arg = type (original )(arg , index = original .index , name = original .name )
494
- elif isinstance (original , ABCIndexClass ):
495
- arg = type (original )(arg )
496
-
497
493
if isinstance (arg , tslib .Timestamp ):
498
494
result = arg
499
495
elif isinstance (arg , ABCSeries ):
0 commit comments