@@ -26,7 +26,6 @@ class providing the base-class of operations.
26
26
from pandas .compat .numpy import function as nv
27
27
from pandas .errors import AbstractMethodError
28
28
from pandas .util ._decorators import Appender , Substitution , cache_readonly
29
- from pandas .util ._validators import validate_kwargs
30
29
31
30
from pandas .core .dtypes .cast import maybe_downcast_to_dtype
32
31
from pandas .core .dtypes .common import (
@@ -349,12 +348,12 @@ def __init__(
349
348
grouper = None ,
350
349
exclusions = None ,
351
350
selection = None ,
352
- as_index = True ,
353
- sort = True ,
354
- group_keys = True ,
355
- squeeze = False ,
356
- observed = False ,
357
- ** kwargs
351
+ as_index : bool = True ,
352
+ sort : bool = True ,
353
+ group_keys : bool = True ,
354
+ squeeze : bool = False ,
355
+ observed : bool = False ,
356
+ mutated : bool = False ,
358
357
):
359
358
360
359
self ._selection = selection
@@ -376,7 +375,7 @@ def __init__(
376
375
self .group_keys = group_keys
377
376
self .squeeze = squeeze
378
377
self .observed = observed
379
- self .mutated = kwargs . pop ( " mutated" , False )
378
+ self .mutated = mutated
380
379
381
380
if grouper is None :
382
381
from pandas .core .groupby .grouper import get_grouper
@@ -396,9 +395,6 @@ def __init__(
396
395
self .grouper = grouper
397
396
self .exclusions = set (exclusions ) if exclusions else set ()
398
397
399
- # we accept no other args
400
- validate_kwargs ("group" , kwargs , {})
401
-
402
398
def __len__ (self ) -> int :
403
399
return len (self .groups )
404
400
@@ -2482,7 +2478,22 @@ def _reindex_output(self, output):
2482
2478
2483
2479
2484
2480
@Appender (GroupBy .__doc__ )
2485
- def groupby (obj : NDFrame , by , ** kwds ):
2481
+ def get_groupby (
2482
+ obj : NDFrame ,
2483
+ by = None ,
2484
+ axis : int = 0 ,
2485
+ level = None ,
2486
+ grouper = None ,
2487
+ exclusions = None ,
2488
+ selection = None ,
2489
+ as_index : bool = True ,
2490
+ sort : bool = True ,
2491
+ group_keys : bool = True ,
2492
+ squeeze : bool = False ,
2493
+ observed : bool = False ,
2494
+ mutated : bool = False ,
2495
+ ):
2496
+
2486
2497
if isinstance (obj , Series ):
2487
2498
from pandas .core .groupby .generic import SeriesGroupBy
2488
2499
@@ -2496,4 +2507,18 @@ def groupby(obj: NDFrame, by, **kwds):
2496
2507
else :
2497
2508
raise TypeError ("invalid type: {obj}" .format (obj = obj ))
2498
2509
2499
- return klass (obj , by , ** kwds )
2510
+ return klass (
2511
+ obj = obj ,
2512
+ keys = by ,
2513
+ axis = axis ,
2514
+ level = level ,
2515
+ grouper = grouper ,
2516
+ exclusions = exclusions ,
2517
+ selection = selection ,
2518
+ as_index = as_index ,
2519
+ sort = sort ,
2520
+ group_keys = group_keys ,
2521
+ squeeze = squeeze ,
2522
+ observed = observed ,
2523
+ mutated = mutated ,
2524
+ )
0 commit comments