@@ -475,8 +475,8 @@ def _adjust_to_origin(arg, origin, unit):
475
475
j_min = Timestamp .min .to_julian_date () - j0
476
476
if np .any (arg > j_max ) or np .any (arg < j_min ):
477
477
raise tslibs .OutOfBoundsDatetime (
478
- "{original} is Out of Bounds for "
479
- "origin='julian'" . format ( original = original )
478
+ f "{ original } is Out of Bounds for "
479
+ "origin='julian'"
480
480
)
481
481
else :
482
482
# arg must be numeric
@@ -485,27 +485,25 @@ def _adjust_to_origin(arg, origin, unit):
485
485
or is_numeric_dtype (np .asarray (arg ))
486
486
):
487
487
raise ValueError (
488
- "'{arg}' is not compatible with origin='{origin}'; "
489
- "it must be numeric with a unit specified " .format (
490
- arg = arg , origin = origin
491
- )
488
+ f"'{ arg } ' is not compatible with origin='{ origin } '; "
489
+ "it must be numeric with a unit specified "
492
490
)
493
491
494
492
# we are going to offset back to unix / epoch time
495
493
try :
496
494
offset = Timestamp (origin )
497
495
except tslibs .OutOfBoundsDatetime :
498
496
raise tslibs .OutOfBoundsDatetime (
499
- "origin {origin} is Out of Bounds" . format ( origin = origin )
497
+ f "origin { origin } is Out of Bounds"
500
498
)
501
499
except ValueError :
502
500
raise ValueError (
503
- "origin {origin} cannot be converted "
504
- "to a Timestamp" . format ( origin = origin )
501
+ f "origin { origin } cannot be converted "
502
+ "to a Timestamp"
505
503
)
506
504
507
505
if offset .tz is not None :
508
- raise ValueError ("origin offset {} must be tz-naive" . format ( offset ) )
506
+ raise ValueError (f "origin offset { offset } must be tz-naive" )
509
507
offset -= Timestamp (0 )
510
508
511
509
# convert the offset to the unit of the arg
@@ -810,8 +808,8 @@ def f(value):
810
808
if len (req ):
811
809
raise ValueError (
812
810
"to assemble mappings requires at least that "
813
- "[year, month, day] be specified: [{required }] "
814
- "is missing" . format ( required = "," . join ( req ))
811
+ f "[year, month, day] be specified: [{ ',' . join ( req ) } ] "
812
+ "is missing"
815
813
)
816
814
817
815
# keys we don't recognize
@@ -820,7 +818,7 @@ def f(value):
820
818
raise ValueError (
821
819
"extra keys have been passed "
822
820
"to the datetime assemblage: "
823
- "[{excess}]" . format ( excess = "," .join (excess ))
821
+ f "[{ ',' .join (excess )} ]"
824
822
)
825
823
826
824
def coerce (values ):
@@ -983,9 +981,9 @@ def _convert_listlike(arg, format):
983
981
except (ValueError , TypeError ):
984
982
if errors == "raise" :
985
983
msg = (
986
- "Cannot convert {element} to a time with given "
987
- "format {format}"
988
- ). format ( element = element , format = format )
984
+ f "Cannot convert { element } to a time with given "
985
+ f "format { format } "
986
+ )
989
987
raise ValueError (msg )
990
988
elif errors == "ignore" :
991
989
return arg
@@ -1012,7 +1010,7 @@ def _convert_listlike(arg, format):
1012
1010
times .append (time_object )
1013
1011
elif errors == "raise" :
1014
1012
raise ValueError (
1015
- "Cannot convert arg {arg} to a time" . format ( arg = arg )
1013
+ f "Cannot convert arg { arg } to a time"
1016
1014
)
1017
1015
elif errors == "ignore" :
1018
1016
return arg
0 commit comments