@@ -96,9 +96,7 @@ def test_selection(self, index, freq, kind, kwargs):
9696 def test_annual_upsample_cases (
9797 self , targ , conv , meth , month , simple_period_range_series
9898 ):
99- ts = simple_period_range_series (
100- "1/1/1990" , "12/31/1991" , freq = "A-{month}" .format (month = month )
101- )
99+ ts = simple_period_range_series ("1/1/1990" , "12/31/1991" , freq = f"A-{ month } " )
102100
103101 result = getattr (ts .resample (targ , convention = conv ), meth )()
104102 expected = result .to_timestamp (targ , how = conv )
@@ -130,9 +128,9 @@ def test_not_subperiod(self, simple_period_range_series, rule, expected_error_ms
130128 # These are incompatible period rules for resampling
131129 ts = simple_period_range_series ("1/1/1990" , "6/30/1995" , freq = "w-wed" )
132130 msg = (
133- "Frequency <Week: weekday=2> cannot be resampled to {}, as they "
134- " are not sub or super periods"
135- ). format ( expected_error_msg )
131+ "Frequency <Week: weekday=2> cannot be resampled to "
132+ f" { expected_error_msg } , as they are not sub or super periods"
133+ )
136134 with pytest .raises (IncompatibleFrequency , match = msg ):
137135 ts .resample (rule ).mean ()
138136
@@ -176,7 +174,7 @@ def test_annual_upsample(self, simple_period_range_series):
176174 def test_quarterly_upsample (
177175 self , month , target , convention , simple_period_range_series
178176 ):
179- freq = "Q-{month}" . format ( month = month )
177+ freq = f "Q-{ month } "
180178 ts = simple_period_range_series ("1/1/1990" , "12/31/1995" , freq = freq )
181179 result = ts .resample (target , convention = convention ).ffill ()
182180 expected = result .to_timestamp (target , how = convention )
@@ -351,7 +349,7 @@ def test_fill_method_and_how_upsample(self):
351349 @pytest .mark .parametrize ("target" , ["D" , "B" ])
352350 @pytest .mark .parametrize ("convention" , ["start" , "end" ])
353351 def test_weekly_upsample (self , day , target , convention , simple_period_range_series ):
354- freq = "W-{day}" . format ( day = day )
352+ freq = f "W-{ day } "
355353 ts = simple_period_range_series ("1/1/1990" , "12/31/1995" , freq = freq )
356354 result = ts .resample (target , convention = convention ).ffill ()
357355 expected = result .to_timestamp (target , how = convention )
@@ -367,16 +365,14 @@ def test_resample_to_timestamps(self, simple_period_range_series):
367365
368366 def test_resample_to_quarterly (self , simple_period_range_series ):
369367 for month in MONTHS :
370- ts = simple_period_range_series (
371- "1990" , "1992" , freq = "A-{month}" .format (month = month )
372- )
373- quar_ts = ts .resample ("Q-{month}" .format (month = month )).ffill ()
368+ ts = simple_period_range_series ("1990" , "1992" , freq = f"A-{ month } " )
369+ quar_ts = ts .resample (f"Q-{ month } " ).ffill ()
374370
375371 stamps = ts .to_timestamp ("D" , how = "start" )
376372 qdates = period_range (
377373 ts .index [0 ].asfreq ("D" , "start" ),
378374 ts .index [- 1 ].asfreq ("D" , "end" ),
379- freq = "Q-{month}" . format ( month = month ) ,
375+ freq = f "Q-{ month } " ,
380376 )
381377
382378 expected = stamps .reindex (qdates .to_timestamp ("D" , "s" ), method = "ffill" )
0 commit comments