@@ -104,13 +104,8 @@ def test_asfreq_fill_value(index):
104
104
def test_resample_interpolate (index ):
105
105
# GH#12925
106
106
df = DataFrame (range (len (index )), index = index )
107
- warn = None
108
- if isinstance (df .index , PeriodIndex ):
109
- warn = FutureWarning
110
- msg = "Resampling with a PeriodIndex is deprecated"
111
- with tm .assert_produces_warning (warn , match = msg ):
112
- result = df .resample ("1min" ).asfreq ().interpolate ()
113
- expected = df .resample ("1min" ).interpolate ()
107
+ result = df .resample ("1min" ).asfreq ().interpolate ()
108
+ expected = df .resample ("1min" ).interpolate ()
114
109
tm .assert_frame_equal (result , expected )
115
110
116
111
@@ -199,13 +194,7 @@ def test_resample_empty_series(freq, index, resample_method):
199
194
elif freq == "ME" and isinstance (ser .index , PeriodIndex ):
200
195
# index is PeriodIndex, so convert to corresponding Period freq
201
196
freq = "M"
202
-
203
- warn = None
204
- if isinstance (ser .index , PeriodIndex ):
205
- warn = FutureWarning
206
- msg = "Resampling with a PeriodIndex is deprecated"
207
- with tm .assert_produces_warning (warn , match = msg ):
208
- rs = ser .resample (freq )
197
+ rs = ser .resample (freq )
209
198
result = getattr (rs , resample_method )()
210
199
211
200
if resample_method == "ohlc" :
@@ -261,9 +250,7 @@ def test_resample_nat_index_series(freq, resample_method):
261
250
262
251
ser = Series (range (5 ), index = PeriodIndex ([NaT ] * 5 , freq = freq ))
263
252
264
- msg = "Resampling with a PeriodIndex is deprecated"
265
- with tm .assert_produces_warning (FutureWarning , match = msg ):
266
- rs = ser .resample (freq )
253
+ rs = ser .resample (freq )
267
254
result = getattr (rs , resample_method )()
268
255
269
256
if resample_method == "ohlc" :
@@ -302,13 +289,7 @@ def test_resample_count_empty_series(freq, index, resample_method):
302
289
elif freq == "ME" and isinstance (ser .index , PeriodIndex ):
303
290
# index is PeriodIndex, so convert to corresponding Period freq
304
291
freq = "M"
305
-
306
- warn = None
307
- if isinstance (ser .index , PeriodIndex ):
308
- warn = FutureWarning
309
- msg = "Resampling with a PeriodIndex is deprecated"
310
- with tm .assert_produces_warning (warn , match = msg ):
311
- rs = ser .resample (freq )
292
+ rs = ser .resample (freq )
312
293
313
294
result = getattr (rs , resample_method )()
314
295
@@ -338,13 +319,7 @@ def test_resample_empty_dataframe(index, freq, resample_method):
338
319
elif freq == "ME" and isinstance (df .index , PeriodIndex ):
339
320
# index is PeriodIndex, so convert to corresponding Period freq
340
321
freq = "M"
341
-
342
- warn = None
343
- if isinstance (df .index , PeriodIndex ):
344
- warn = FutureWarning
345
- msg = "Resampling with a PeriodIndex is deprecated"
346
- with tm .assert_produces_warning (warn , match = msg ):
347
- rs = df .resample (freq , group_keys = False )
322
+ rs = df .resample (freq , group_keys = False )
348
323
result = getattr (rs , resample_method )()
349
324
if resample_method == "ohlc" :
350
325
# TODO: no tests with len(df.columns) > 0
@@ -386,14 +361,7 @@ def test_resample_count_empty_dataframe(freq, index):
386
361
elif freq == "ME" and isinstance (empty_frame_dti .index , PeriodIndex ):
387
362
# index is PeriodIndex, so convert to corresponding Period freq
388
363
freq = "M"
389
-
390
- warn = None
391
- if isinstance (empty_frame_dti .index , PeriodIndex ):
392
- warn = FutureWarning
393
- msg = "Resampling with a PeriodIndex is deprecated"
394
- with tm .assert_produces_warning (warn , match = msg ):
395
- rs = empty_frame_dti .resample (freq )
396
- result = rs .count ()
364
+ result = empty_frame_dti .resample (freq ).count ()
397
365
398
366
index = _asfreq_compat (empty_frame_dti .index , freq )
399
367
@@ -422,14 +390,7 @@ def test_resample_size_empty_dataframe(freq, index):
422
390
elif freq == "ME" and isinstance (empty_frame_dti .index , PeriodIndex ):
423
391
# index is PeriodIndex, so convert to corresponding Period freq
424
392
freq = "M"
425
-
426
- msg = "Resampling with a PeriodIndex"
427
- warn = None
428
- if isinstance (empty_frame_dti .index , PeriodIndex ):
429
- warn = FutureWarning
430
- with tm .assert_produces_warning (warn , match = msg ):
431
- rs = empty_frame_dti .resample (freq )
432
- result = rs .size ()
393
+ result = empty_frame_dti .resample (freq ).size ()
433
394
434
395
index = _asfreq_compat (empty_frame_dti .index , freq )
435
396
@@ -465,21 +426,12 @@ def test_resample_apply_empty_dataframe(index, freq, method):
465
426
],
466
427
)
467
428
@pytest .mark .parametrize ("dtype" , [float , int , object , "datetime64[ns]" ])
468
- @pytest .mark .filterwarnings (r"ignore:PeriodDtype\[B\] is deprecated:FutureWarning" )
469
429
def test_resample_empty_dtypes (index , dtype , resample_method ):
470
430
# Empty series were sometimes causing a segfault (for the functions
471
431
# with Cython bounds-checking disabled) or an IndexError. We just run
472
432
# them to ensure they no longer do. (GH #10228)
473
- warn = None
474
- if isinstance (index , PeriodIndex ):
475
- # GH#53511
476
- index = PeriodIndex ([], freq = "B" , name = index .name )
477
- warn = FutureWarning
478
- msg = "Resampling with a PeriodIndex is deprecated"
479
-
480
433
empty_series_dti = Series ([], index , dtype )
481
- with tm .assert_produces_warning (warn , match = msg ):
482
- rs = empty_series_dti .resample ("D" , group_keys = False )
434
+ rs = empty_series_dti .resample ("D" , group_keys = False )
483
435
try :
484
436
getattr (rs , resample_method )()
485
437
except DataError :
@@ -512,18 +464,8 @@ def test_apply_to_empty_series(index, freq):
512
464
elif freq == "ME" and isinstance (ser .index , PeriodIndex ):
513
465
# index is PeriodIndex, so convert to corresponding Period freq
514
466
freq = "M"
515
-
516
- msg = "Resampling with a PeriodIndex"
517
- warn = None
518
- if isinstance (ser .index , PeriodIndex ):
519
- warn = FutureWarning
520
-
521
- with tm .assert_produces_warning (warn , match = msg ):
522
- rs = ser .resample (freq , group_keys = False )
523
-
524
- result = rs .apply (lambda x : 1 )
525
- with tm .assert_produces_warning (warn , match = msg ):
526
- expected = ser .resample (freq ).apply ("sum" )
467
+ result = ser .resample (freq , group_keys = False ).apply (lambda x : 1 )
468
+ expected = ser .resample (freq ).apply ("sum" )
527
469
528
470
tm .assert_series_equal (result , expected , check_dtype = False )
529
471
@@ -541,16 +483,8 @@ def test_resampler_is_iterable(index):
541
483
series = Series (range (len (index )), index = index )
542
484
freq = "h"
543
485
tg = Grouper (freq = freq , convention = "start" )
544
- msg = "Resampling with a PeriodIndex"
545
- warn = None
546
- if isinstance (series .index , PeriodIndex ):
547
- warn = FutureWarning
548
-
549
- with tm .assert_produces_warning (warn , match = msg ):
550
- grouped = series .groupby (tg )
551
-
552
- with tm .assert_produces_warning (warn , match = msg ):
553
- resampled = series .resample (freq )
486
+ grouped = series .groupby (tg )
487
+ resampled = series .resample (freq )
554
488
for (rk , rv ), (gk , gv ) in zip (resampled , grouped ):
555
489
assert rk == gk
556
490
tm .assert_series_equal (rv , gv )
@@ -570,13 +504,8 @@ def test_resample_quantile(index):
570
504
q = 0.75
571
505
freq = "h"
572
506
573
- msg = "Resampling with a PeriodIndex"
574
- warn = None
575
- if isinstance (ser .index , PeriodIndex ):
576
- warn = FutureWarning
577
- with tm .assert_produces_warning (warn , match = msg ):
578
- result = ser .resample (freq ).quantile (q )
579
- expected = ser .resample (freq ).agg (lambda x : x .quantile (q )).rename (ser .name )
507
+ result = ser .resample (freq ).quantile (q )
508
+ expected = ser .resample (freq ).agg (lambda x : x .quantile (q )).rename (ser .name )
580
509
tm .assert_series_equal (result , expected )
581
510
582
511
0 commit comments