@@ -246,7 +246,7 @@ def df2scalar(val: DataFrame) -> float:
246
246
)
247
247
248
248
# interpolate
249
- try :
249
+ if PD_LTE_22 :
250
250
check (assert_type (GB_DF .resample ("ME" ).interpolate (), DataFrame ), DataFrame )
251
251
check (
252
252
assert_type (
@@ -258,12 +258,7 @@ def df2scalar(val: DataFrame) -> float:
258
258
assert_type (GB_DF .resample ("ME" ).interpolate (inplace = True ), None ),
259
259
type (None ),
260
260
)
261
- except NotImplementedError :
262
- # In version 3.0, this is not allowed
263
- if PD_LTE_22 :
264
- raise RuntimeError ("Should not happen" )
265
-
266
- if not PD_LTE_22 :
261
+ else :
267
262
268
263
def resample_interpolate (x : DataFrame ) -> DataFrame :
269
264
return x .resample ("ME" ).interpolate ()
@@ -427,7 +422,7 @@ def f(val: Series) -> float:
427
422
check (assert_type (GB_S .resample ("ME" ).asfreq (- 1.0 ), "Series[float]" ), Series , float )
428
423
429
424
# interpolate
430
- try :
425
+ if PD_LTE_22 :
431
426
check (
432
427
assert_type (GB_S .resample ("ME" ).interpolate (), "Series[float]" ),
433
428
Series ,
@@ -436,11 +431,7 @@ def f(val: Series) -> float:
436
431
check (
437
432
assert_type (GB_S .resample ("ME" ).interpolate (inplace = True ), None ), type (None )
438
433
)
439
- except NotImplementedError :
440
- if PD_LTE_22 :
441
- raise RuntimeError ("should not happen" )
442
-
443
- if not PD_LTE_22 :
434
+ else :
444
435
check (
445
436
assert_type (
446
437
GB_S .apply (lambda x : x .resample ("ME" ).interpolate ()), "Series[float]"
0 commit comments