@@ -277,9 +277,9 @@ def __init__(
277
277
):
278
278
if isinstance (objs , (NDFrame , str )):
279
279
raise TypeError (
280
- "first argument must be an iterable of pandas "
281
- "objects, you passed an object of type "
282
- '"{name}"' . format ( name = type (objs ).__name__ )
280
+ f "first argument must be an iterable of pandas "
281
+ f "objects, you passed an object of type "
282
+ f '"{ type (objs ).__name__ } "'
283
283
)
284
284
285
285
if join == "outer" :
@@ -324,8 +324,8 @@ def __init__(
324
324
for obj in objs :
325
325
if not isinstance (obj , (Series , DataFrame )):
326
326
msg = (
327
- "cannot concatenate object of type '{typ }';"
328
- " only Series and DataFrame objs are valid" . format ( typ = type ( obj ))
327
+ f "cannot concatenate object of type '{ type ( obj ) } ';"
328
+ " only Series and DataFrame objs are valid"
329
329
)
330
330
raise TypeError (msg )
331
331
@@ -375,8 +375,7 @@ def __init__(
375
375
self ._is_series = isinstance (sample , Series )
376
376
if not 0 <= axis <= sample .ndim :
377
377
raise AssertionError (
378
- "axis must be between 0 and {ndim}, input was"
379
- " {axis}" .format (ndim = sample .ndim , axis = axis )
378
+ f"axis must be between 0 and { sample .ndim } , input was" f" { axis } "
380
379
)
381
380
382
381
# if we have mixed ndims, then convert to highest ndim
@@ -506,8 +505,7 @@ def _get_new_axes(self):
506
505
507
506
if len (self .join_axes ) != ndim - 1 :
508
507
raise AssertionError (
509
- "length of join_axes must be equal "
510
- "to {length}" .format (length = ndim - 1 )
508
+ f"length of join_axes must be equal " f"to { ndim - 1 } "
511
509
)
512
510
513
511
# ufff...
@@ -528,7 +526,7 @@ def _get_comb_axis(self, i):
528
526
)
529
527
except IndexError :
530
528
types = [type (x ).__name__ for x in self .objs ]
531
- raise TypeError ("Cannot concatenate list of {types}" . format ( types = types ) )
529
+ raise TypeError (f "Cannot concatenate list of { types } " )
532
530
533
531
def _get_concat_axis (self ):
534
532
"""
@@ -547,8 +545,8 @@ def _get_concat_axis(self):
547
545
for i , x in enumerate (self .objs ):
548
546
if not isinstance (x , Series ):
549
547
raise TypeError (
550
- "Cannot concatenate type 'Series' "
551
- "with object of type {type!r}" . format ( type = type ( x ).__name__ )
548
+ f "Cannot concatenate type 'Series' "
549
+ f "with object of type { type ( x ).__name__ !r } "
552
550
)
553
551
if x .name is not None :
554
552
names [i ] = x .name
@@ -584,10 +582,7 @@ def _maybe_check_integrity(self, concat_index: Index):
584
582
if self .verify_integrity :
585
583
if not concat_index .is_unique :
586
584
overlap = concat_index [concat_index .duplicated ()].unique ()
587
- raise ValueError (
588
- "Indexes have overlapping values: "
589
- "{overlap!s}" .format (overlap = overlap )
590
- )
585
+ raise ValueError (f"Indexes have overlapping values: " f"{ overlap !s} " )
591
586
592
587
593
588
def _concat_indexes (indexes ) -> Index :
@@ -629,11 +624,7 @@ def _make_concat_multiindex(indexes, keys, levels=None, names=None) -> MultiInde
629
624
try :
630
625
i = level .get_loc (key )
631
626
except KeyError :
632
- raise ValueError (
633
- "Key {key!s} not in level {level!s}" .format (
634
- key = key , level = level
635
- )
636
- )
627
+ raise ValueError (f"Key { key !s} not in level { level !s} " )
637
628
638
629
to_concat .append (np .repeat (i , len (index )))
639
630
codes_list .append (np .concatenate (to_concat ))
@@ -685,11 +676,7 @@ def _make_concat_multiindex(indexes, keys, levels=None, names=None) -> MultiInde
685
676
686
677
mask = mapped == - 1
687
678
if mask .any ():
688
- raise ValueError (
689
- "Values not found in passed level: {hlevel!s}" .format (
690
- hlevel = hlevel [mask ]
691
- )
692
- )
679
+ raise ValueError (f"Values not found in passed level: { hlevel [mask ]!s} " )
693
680
694
681
new_codes .append (np .repeat (mapped , n ))
695
682
0 commit comments