@@ -1212,8 +1212,7 @@ cdef str period_format(int64_t value, int freq, object fmt=None):
1212
1212
elif freq_group == 4000 : # WK
1213
1213
left = period_asfreq(value, freq, 6000 , 0 )
1214
1214
right = period_asfreq(value, freq, 6000 , 1 )
1215
- return ' %s /%s ' % (period_format(left, 6000 ),
1216
- period_format(right, 6000 ))
1215
+ return f" {period_format(left, 6000)}/{period_format(right, 6000)}"
1217
1216
elif (freq_group == 5000 # BUS
1218
1217
or freq_group == 6000 ): # DAY
1219
1218
fmt = b' %Y -%m -%d '
@@ -1230,7 +1229,7 @@ cdef str period_format(int64_t value, int freq, object fmt=None):
1230
1229
elif freq_group == 12000 : # NANOSEC
1231
1230
fmt = b' %Y -%m -%d %H :%M :%S .%n '
1232
1231
else :
1233
- raise ValueError (f' Unknown freq: {freq}' )
1232
+ raise ValueError (f" Unknown freq: {freq}" )
1234
1233
1235
1234
return _period_strftime(value, freq, fmt)
1236
1235
@@ -1276,15 +1275,15 @@ cdef str _period_strftime(int64_t value, int freq, bytes fmt):
1276
1275
if i == 0 :
1277
1276
repl = str (quarter)
1278
1277
elif i == 1 : # %f, 2-digit year
1279
- repl = f' {(year % 100):02d}'
1278
+ repl = f" {(year % 100):02d}"
1280
1279
elif i == 2 :
1281
1280
repl = str (year)
1282
1281
elif i == 3 :
1283
- repl = f' {(value % 1_000):03d}'
1282
+ repl = f" {(value % 1_000):03d}"
1284
1283
elif i == 4 :
1285
- repl = f' {(value % 1_000_000):06d}'
1284
+ repl = f" {(value % 1_000_000):06d}"
1286
1285
elif i == 5 :
1287
- repl = f' {(value % 1_000_000_000):09d}'
1286
+ repl = f" {(value % 1_000_000_000):09d}"
1288
1287
1289
1288
result = result.replace(str_extra_fmts[i], repl)
1290
1289
@@ -1392,7 +1391,7 @@ def get_period_field_arr(int code, int64_t[:] arr, int freq):
1392
1391
1393
1392
func = _get_accessor_func(code)
1394
1393
if func is NULL :
1395
- raise ValueError (f' Unrecognized period code: {code}' )
1394
+ raise ValueError (f" Unrecognized period code: {code}" )
1396
1395
1397
1396
sz = len (arr)
1398
1397
out = np.empty(sz, dtype = np.int64)
@@ -1579,8 +1578,8 @@ cdef class _Period:
1579
1578
freq = to_offset(freq)
1580
1579
1581
1580
if freq.n <= 0 :
1582
- raise ValueError (f ' Frequency must be positive, because it '
1583
- f' represents span: {freq.freqstr}' )
1581
+ raise ValueError (" Frequency must be positive, because it "
1582
+ f" represents span: {freq.freqstr}" )
1584
1583
1585
1584
return freq
1586
1585
@@ -1614,8 +1613,8 @@ cdef class _Period:
1614
1613
return NotImplemented
1615
1614
elif op == Py_NE:
1616
1615
return NotImplemented
1617
- raise TypeError (f' Cannot compare type {type(self).__name__} '
1618
- f' with type {type(other).__name__}' )
1616
+ raise TypeError (f" Cannot compare type {type(self).__name__} "
1617
+ f" with type {type(other).__name__}" )
1619
1618
1620
1619
def __hash__ (self ):
1621
1620
return hash ((self .ordinal, self .freqstr))
@@ -1633,8 +1632,8 @@ cdef class _Period:
1633
1632
if nanos % offset_nanos == 0 :
1634
1633
ordinal = self .ordinal + (nanos // offset_nanos)
1635
1634
return Period(ordinal = ordinal, freq = self .freq)
1636
- raise IncompatibleFrequency(f ' Input cannot be converted to '
1637
- f' Period(freq={self.freqstr})' )
1635
+ raise IncompatibleFrequency(" Input cannot be converted to "
1636
+ f" Period(freq={self.freqstr})" )
1638
1637
elif util.is_offset_object(other):
1639
1638
freqstr = other.rule_code
1640
1639
base = get_base_alias(freqstr)
0 commit comments