@@ -1006,14 +1006,65 @@ def take(
1006
1006
result = self ._op_via_apply ("take" , indices = indices , axis = axis , ** kwargs )
1007
1007
return result
1008
1008
1009
- @doc (Series .skew .__doc__ )
1010
1009
def skew (
1011
1010
self ,
1012
1011
axis : Axis | lib .NoDefault = lib .no_default ,
1013
1012
skipna : bool = True ,
1014
1013
numeric_only : bool = False ,
1015
1014
** kwargs ,
1016
1015
) -> Series :
1016
+ """
1017
+ Return unbiased skew within groups.
1018
+
1019
+ Normalized by N-1.
1020
+
1021
+ Parameters
1022
+ ----------
1023
+ axis : {0 or 'index', 1 or 'columns', None}, default 0
1024
+ Axis for the function to be applied on.
1025
+ This parameter is only for compatibility with DataFrame and is unused.
1026
+
1027
+ skipna : bool, default True
1028
+ Exclude NA/null values when computing the result.
1029
+
1030
+ numeric_only : bool, default False
1031
+ Include only float, int, boolean columns. Not implemented for Series.
1032
+
1033
+ **kwargs
1034
+ Additional keyword arguments to be passed to the function.
1035
+
1036
+ Returns
1037
+ -------
1038
+ Series
1039
+
1040
+ See Also
1041
+ --------
1042
+ Series.skew : Return unbiased skew over requested axis.
1043
+
1044
+ Examples
1045
+ --------
1046
+ >>> ser = pd.Series([390., 350., 357., np.nan, 22., 20., 30.],
1047
+ ... index=['Falcon', 'Falcon', 'Falcon', 'Falcon',
1048
+ ... 'Parrot', 'Parrot', 'Parrot'],
1049
+ ... name="Max Speed")
1050
+ >>> ser
1051
+ Falcon 390.0
1052
+ Falcon 350.0
1053
+ Falcon 357.0
1054
+ Falcon NaN
1055
+ Parrot 22.0
1056
+ Parrot 20.0
1057
+ Parrot 30.0
1058
+ Name: Max Speed, dtype: float64
1059
+ >>> ser.groupby(level=0).skew()
1060
+ Falcon 1.525174
1061
+ Parrot 1.457863
1062
+ Name: Max Speed, dtype: float64
1063
+ >>> ser.groupby(level=0).skew(skipna=False)
1064
+ Falcon NaN
1065
+ Parrot 1.457863
1066
+ Name: Max Speed, dtype: float64
1067
+ """
1017
1068
result = self ._op_via_apply (
1018
1069
"skew" ,
1019
1070
axis = axis ,
@@ -2473,14 +2524,76 @@ def take(
2473
2524
result = self ._op_via_apply ("take" , indices = indices , axis = axis , ** kwargs )
2474
2525
return result
2475
2526
2476
- @doc (DataFrame .skew .__doc__ )
2477
2527
def skew (
2478
2528
self ,
2479
2529
axis : Axis | None | lib .NoDefault = lib .no_default ,
2480
2530
skipna : bool = True ,
2481
2531
numeric_only : bool = False ,
2482
2532
** kwargs ,
2483
2533
) -> DataFrame :
2534
+ """
2535
+ Return unbiased skew within groups.
2536
+
2537
+ Normalized by N-1.
2538
+
2539
+ Parameters
2540
+ ----------
2541
+ axis : {0 or 'index', 1 or 'columns', None}, default 0
2542
+ Axis for the function to be applied on.
2543
+
2544
+ Specifying ``axis=None`` will apply the aggregation across both axes.
2545
+
2546
+ .. versionadded:: 2.0.0
2547
+
2548
+ skipna : bool, default True
2549
+ Exclude NA/null values when computing the result.
2550
+
2551
+ numeric_only : bool, default False
2552
+ Include only float, int, boolean columns.
2553
+
2554
+ **kwargs
2555
+ Additional keyword arguments to be passed to the function.
2556
+
2557
+ Returns
2558
+ -------
2559
+ DataFrame
2560
+
2561
+ See Also
2562
+ --------
2563
+ DataFrame.skew : Return unbiased skew over requested axis.
2564
+
2565
+ Examples
2566
+ --------
2567
+ >>> arrays = [['falcon', 'parrot', 'cockatoo', 'kiwi',
2568
+ ... 'lion', 'monkey', 'rabbit'],
2569
+ ... ['bird', 'bird', 'bird', 'bird',
2570
+ ... 'mammal', 'mammal', 'mammal']]
2571
+ >>> index = pd.MultiIndex.from_arrays(arrays, names=('name', 'class'))
2572
+ >>> df = pd.DataFrame({'max_speed': [389.0, 24.0, 70.0, np.nan,
2573
+ ... 80.5, 21.5, 15.0]},
2574
+ ... index=index)
2575
+ >>> df
2576
+ max_speed
2577
+ name class
2578
+ falcon bird 389.0
2579
+ parrot bird 24.0
2580
+ cockatoo bird 70.0
2581
+ kiwi bird NaN
2582
+ lion mammal 80.5
2583
+ monkey mammal 21.5
2584
+ rabbit mammal 15.0
2585
+ >>> gb = df.groupby(["class"])
2586
+ >>> gb.skew()
2587
+ max_speed
2588
+ class
2589
+ bird 1.628296
2590
+ mammal 1.669046
2591
+ >>> gb.skew(skipna=False)
2592
+ max_speed
2593
+ class
2594
+ bird NaN
2595
+ mammal 1.669046
2596
+ """
2484
2597
result = self ._op_via_apply (
2485
2598
"skew" ,
2486
2599
axis = axis ,
0 commit comments