@@ -10601,8 +10601,7 @@ def _add_numeric_operations(cls):
10601
10601
def any (self , axis = 0 , bool_only = None , skipna = True , level = None , ** kwargs ):
10602
10602
return NDFrame .any (self , axis , bool_only , skipna , level , ** kwargs )
10603
10603
10604
- # error: Cannot assign to a method
10605
- cls .any = any # type: ignore[assignment]
10604
+ setattr (cls , "any" , any )
10606
10605
10607
10606
@doc (
10608
10607
_bool_doc ,
@@ -10617,12 +10616,7 @@ def any(self, axis=0, bool_only=None, skipna=True, level=None, **kwargs):
10617
10616
def all (self , axis = 0 , bool_only = None , skipna = True , level = None , ** kwargs ):
10618
10617
return NDFrame .all (self , axis , bool_only , skipna , level , ** kwargs )
10619
10618
10620
- # error: Cannot assign to a method
10621
-
10622
- # error: Incompatible types in assignment (expression has type
10623
- # "Callable[[Iterable[object]], bool]", variable has type "Callable[[NDFrame,
10624
- # Any, Any, Any, Any, KwArg(Any)], Any]")
10625
- cls .all = all # type: ignore[assignment]
10619
+ setattr (cls , "all" , all )
10626
10620
10627
10621
# error: Argument 1 to "doc" has incompatible type "Optional[str]"; expected
10628
10622
# "Union[str, Callable[..., Any]]"
@@ -10639,8 +10633,7 @@ def all(self, axis=0, bool_only=None, skipna=True, level=None, **kwargs):
10639
10633
def mad (self , axis = None , skipna = None , level = None ):
10640
10634
return NDFrame .mad (self , axis , skipna , level )
10641
10635
10642
- # error: Cannot assign to a method
10643
- cls .mad = mad # type: ignore[assignment]
10636
+ setattr (cls , "mad" , mad )
10644
10637
10645
10638
@doc (
10646
10639
_num_ddof_doc ,
@@ -10662,8 +10655,7 @@ def sem(
10662
10655
):
10663
10656
return NDFrame .sem (self , axis , skipna , level , ddof , numeric_only , ** kwargs )
10664
10657
10665
- # error: Cannot assign to a method
10666
- cls .sem = sem # type: ignore[assignment]
10658
+ setattr (cls , "sem" , sem )
10667
10659
10668
10660
@doc (
10669
10661
_num_ddof_doc ,
@@ -10684,8 +10676,7 @@ def var(
10684
10676
):
10685
10677
return NDFrame .var (self , axis , skipna , level , ddof , numeric_only , ** kwargs )
10686
10678
10687
- # error: Cannot assign to a method
10688
- cls .var = var # type: ignore[assignment]
10679
+ setattr (cls , "var" , var )
10689
10680
10690
10681
@doc (
10691
10682
_num_ddof_doc ,
@@ -10707,8 +10698,7 @@ def std(
10707
10698
):
10708
10699
return NDFrame .std (self , axis , skipna , level , ddof , numeric_only , ** kwargs )
10709
10700
10710
- # error: Cannot assign to a method
10711
- cls .std = std # type: ignore[assignment]
10701
+ setattr (cls , "std" , std )
10712
10702
10713
10703
@doc (
10714
10704
_cnum_doc ,
@@ -10722,8 +10712,7 @@ def std(
10722
10712
def cummin (self , axis = None , skipna = True , * args , ** kwargs ):
10723
10713
return NDFrame .cummin (self , axis , skipna , * args , ** kwargs )
10724
10714
10725
- # error: Cannot assign to a method
10726
- cls .cummin = cummin # type: ignore[assignment]
10715
+ setattr (cls , "cummin" , cummin )
10727
10716
10728
10717
@doc (
10729
10718
_cnum_doc ,
@@ -10737,8 +10726,7 @@ def cummin(self, axis=None, skipna=True, *args, **kwargs):
10737
10726
def cummax (self , axis = None , skipna = True , * args , ** kwargs ):
10738
10727
return NDFrame .cummax (self , axis , skipna , * args , ** kwargs )
10739
10728
10740
- # error: Cannot assign to a method
10741
- cls .cummax = cummax # type: ignore[assignment]
10729
+ setattr (cls , "cummax" , cummax )
10742
10730
10743
10731
@doc (
10744
10732
_cnum_doc ,
@@ -10752,8 +10740,7 @@ def cummax(self, axis=None, skipna=True, *args, **kwargs):
10752
10740
def cumsum (self , axis = None , skipna = True , * args , ** kwargs ):
10753
10741
return NDFrame .cumsum (self , axis , skipna , * args , ** kwargs )
10754
10742
10755
- # error: Cannot assign to a method
10756
- cls .cumsum = cumsum # type: ignore[assignment]
10743
+ setattr (cls , "cumsum" , cumsum )
10757
10744
10758
10745
@doc (
10759
10746
_cnum_doc ,
@@ -10767,8 +10754,7 @@ def cumsum(self, axis=None, skipna=True, *args, **kwargs):
10767
10754
def cumprod (self , axis = None , skipna = True , * args , ** kwargs ):
10768
10755
return NDFrame .cumprod (self , axis , skipna , * args , ** kwargs )
10769
10756
10770
- # error: Cannot assign to a method
10771
- cls .cumprod = cumprod # type: ignore[assignment]
10757
+ setattr (cls , "cumprod" , cumprod )
10772
10758
10773
10759
@doc (
10774
10760
_num_doc ,
@@ -10794,8 +10780,7 @@ def sum(
10794
10780
self , axis , skipna , level , numeric_only , min_count , ** kwargs
10795
10781
)
10796
10782
10797
- # error: Cannot assign to a method
10798
- cls .sum = sum # type: ignore[assignment]
10783
+ setattr (cls , "sum" , sum )
10799
10784
10800
10785
@doc (
10801
10786
_num_doc ,
@@ -10820,8 +10805,7 @@ def prod(
10820
10805
self , axis , skipna , level , numeric_only , min_count , ** kwargs
10821
10806
)
10822
10807
10823
- # error: Cannot assign to a method
10824
- cls .prod = prod # type: ignore[assignment]
10808
+ setattr (cls , "prod" , prod )
10825
10809
cls .product = prod
10826
10810
10827
10811
@doc (
@@ -10837,8 +10821,7 @@ def prod(
10837
10821
def mean (self , axis = None , skipna = None , level = None , numeric_only = None , ** kwargs ):
10838
10822
return NDFrame .mean (self , axis , skipna , level , numeric_only , ** kwargs )
10839
10823
10840
- # error: Cannot assign to a method
10841
- cls .mean = mean # type: ignore[assignment]
10824
+ setattr (cls , "mean" , mean )
10842
10825
10843
10826
@doc (
10844
10827
_num_doc ,
@@ -10853,8 +10836,7 @@ def mean(self, axis=None, skipna=None, level=None, numeric_only=None, **kwargs):
10853
10836
def skew (self , axis = None , skipna = None , level = None , numeric_only = None , ** kwargs ):
10854
10837
return NDFrame .skew (self , axis , skipna , level , numeric_only , ** kwargs )
10855
10838
10856
- # error: Cannot assign to a method
10857
- cls .skew = skew # type: ignore[assignment]
10839
+ setattr (cls , "skew" , skew )
10858
10840
10859
10841
@doc (
10860
10842
_num_doc ,
@@ -10872,8 +10854,7 @@ def skew(self, axis=None, skipna=None, level=None, numeric_only=None, **kwargs):
10872
10854
def kurt (self , axis = None , skipna = None , level = None , numeric_only = None , ** kwargs ):
10873
10855
return NDFrame .kurt (self , axis , skipna , level , numeric_only , ** kwargs )
10874
10856
10875
- # error: Cannot assign to a method
10876
- cls .kurt = kurt # type: ignore[assignment]
10857
+ setattr (cls , "kurt" , kurt )
10877
10858
cls .kurtosis = kurt
10878
10859
10879
10860
@doc (
@@ -10891,8 +10872,7 @@ def median(
10891
10872
):
10892
10873
return NDFrame .median (self , axis , skipna , level , numeric_only , ** kwargs )
10893
10874
10894
- # error: Cannot assign to a method
10895
- cls .median = median # type: ignore[assignment]
10875
+ setattr (cls , "median" , median )
10896
10876
10897
10877
@doc (
10898
10878
_num_doc ,
@@ -10909,8 +10889,7 @@ def median(
10909
10889
def max (self , axis = None , skipna = None , level = None , numeric_only = None , ** kwargs ):
10910
10890
return NDFrame .max (self , axis , skipna , level , numeric_only , ** kwargs )
10911
10891
10912
- # error: Cannot assign to a method
10913
- cls .max = max # type: ignore[assignment]
10892
+ setattr (cls , "max" , max )
10914
10893
10915
10894
@doc (
10916
10895
_num_doc ,
@@ -10927,8 +10906,7 @@ def max(self, axis=None, skipna=None, level=None, numeric_only=None, **kwargs):
10927
10906
def min (self , axis = None , skipna = None , level = None , numeric_only = None , ** kwargs ):
10928
10907
return NDFrame .min (self , axis , skipna , level , numeric_only , ** kwargs )
10929
10908
10930
- # error: Cannot assign to a method
10931
- cls .min = min # type: ignore[assignment]
10909
+ setattr (cls , "min" , min )
10932
10910
10933
10911
@final
10934
10912
@doc (Rolling )
0 commit comments