@@ -260,7 +260,7 @@ class providing the base-class of operations.
260
260
each group together into a Series, including setting the index as
261
261
appropriate:
262
262
263
- >>> g1[['B', 'C']] .apply(lambda x: x.C.max() - x.B.min())
263
+ >>> g1.apply(lambda x: x.C.max() - x.B.min())
264
264
A
265
265
a 5
266
266
b 2
@@ -1488,16 +1488,6 @@ def f(g):
1488
1488
with option_context ("mode.chained_assignment" , None ):
1489
1489
try :
1490
1490
result = self ._python_apply_general (f , self ._selected_obj )
1491
- if (
1492
- not isinstance (self .obj , Series )
1493
- and self ._selection is None
1494
- and self ._selected_obj .shape != self ._obj_with_exclusions .shape
1495
- ):
1496
- warnings .warn (
1497
- message = _apply_groupings_depr .format (type (self ).__name__ ),
1498
- category = FutureWarning ,
1499
- stacklevel = find_stack_level (),
1500
- )
1501
1491
except TypeError :
1502
1492
# gh-20949
1503
1493
# try again, with .apply acting as a filtering
@@ -2659,55 +2649,55 @@ def resample(self, rule, *args, **kwargs):
2659
2649
Downsample the DataFrame into 3 minute bins and sum the values of
2660
2650
the timestamps falling into a bin.
2661
2651
2662
- >>> df.groupby('a')[['b']] .resample('3T').sum()
2663
- b
2652
+ >>> df.groupby('a').resample('3T').sum()
2653
+ a b
2664
2654
a
2665
- 0 2000-01-01 00:00:00 2
2666
- 2000-01-01 00:03:00 1
2667
- 5 2000-01-01 00:00:00 1
2655
+ 0 2000-01-01 00:00:00 0 2
2656
+ 2000-01-01 00:03:00 0 1
2657
+ 5 2000-01-01 00:00:00 5 1
2668
2658
2669
2659
Upsample the series into 30 second bins.
2670
2660
2671
- >>> df.groupby('a')[['b']] .resample('30S').sum()
2672
- b
2661
+ >>> df.groupby('a').resample('30S').sum()
2662
+ a b
2673
2663
a
2674
- 0 2000-01-01 00:00:00 1
2675
- 2000-01-01 00:00:30 0
2676
- 2000-01-01 00:01:00 1
2677
- 2000-01-01 00:01:30 0
2678
- 2000-01-01 00:02:00 0
2679
- 2000-01-01 00:02:30 0
2680
- 2000-01-01 00:03:00 1
2681
- 5 2000-01-01 00:02:00 1
2664
+ 0 2000-01-01 00:00:00 0 1
2665
+ 2000-01-01 00:00:30 0 0
2666
+ 2000-01-01 00:01:00 0 1
2667
+ 2000-01-01 00:01:30 0 0
2668
+ 2000-01-01 00:02:00 0 0
2669
+ 2000-01-01 00:02:30 0 0
2670
+ 2000-01-01 00:03:00 0 1
2671
+ 5 2000-01-01 00:02:00 5 1
2682
2672
2683
2673
Resample by month. Values are assigned to the month of the period.
2684
2674
2685
- >>> df.groupby('a')[['b']] .resample('M').sum()
2686
- b
2675
+ >>> df.groupby('a').resample('M').sum()
2676
+ a b
2687
2677
a
2688
- 0 2000-01-31 3
2689
- 5 2000-01-31 1
2678
+ 0 2000-01-31 0 3
2679
+ 5 2000-01-31 5 1
2690
2680
2691
2681
Downsample the series into 3 minute bins as above, but close the right
2692
2682
side of the bin interval.
2693
2683
2694
- >>> df.groupby('a')[['b']] .resample('3T', closed='right').sum()
2695
- b
2684
+ >>> df.groupby('a').resample('3T', closed='right').sum()
2685
+ a b
2696
2686
a
2697
- 0 1999-12-31 23:57:00 1
2698
- 2000-01-01 00:00:00 2
2699
- 5 2000-01-01 00:00:00 1
2687
+ 0 1999-12-31 23:57:00 0 1
2688
+ 2000-01-01 00:00:00 0 2
2689
+ 5 2000-01-01 00:00:00 5 1
2700
2690
2701
2691
Downsample the series into 3 minute bins and close the right side of
2702
2692
the bin interval, but label each bin using the right edge instead of
2703
2693
the left.
2704
2694
2705
- >>> df.groupby('a')[['b']] .resample('3T', closed='right', label='right').sum()
2706
- b
2695
+ >>> df.groupby('a').resample('3T', closed='right', label='right').sum()
2696
+ a b
2707
2697
a
2708
- 0 2000-01-01 00:00:00 1
2709
- 2000-01-01 00:03:00 2
2710
- 5 2000-01-01 00:03:00 1
2698
+ 0 2000-01-01 00:00:00 0 1
2699
+ 2000-01-01 00:03:00 0 2
2700
+ 5 2000-01-01 00:03:00 5 1
2711
2701
"""
2712
2702
from pandas .core .resample import get_resampler_for_grouping
2713
2703
@@ -4329,13 +4319,3 @@ def _insert_quantile_level(idx: Index, qs: npt.NDArray[np.float64]) -> MultiInde
4329
4319
else :
4330
4320
mi = MultiIndex .from_product ([idx , qs ])
4331
4321
return mi
4332
-
4333
-
4334
- # GH#7155
4335
- _apply_groupings_depr = (
4336
- "{}.apply operated on the grouping columns. This behavior is deprecated, "
4337
- "and in a future version of pandas the grouping columns will be excluded "
4338
- "from the operation. Select the columns to operate on after groupby to "
4339
- "either explicitly include or exclude the groupings and silence "
4340
- "this warning."
4341
- )
0 commit comments