@@ -11945,7 +11945,6 @@ def sem(
11945
11945
) -> Series | Any : ...
11946
11946
11947
11947
@deprecate_nonkeyword_arguments (version = "3.0" , allowed_args = ["self" ], name = "sem" )
11948
- @doc (make_doc ("sem" , ndim = 2 ))
11949
11948
def sem (
11950
11949
self ,
11951
11950
axis : Axis | None = 0 ,
@@ -11954,6 +11953,76 @@ def sem(
11954
11953
numeric_only : bool = False ,
11955
11954
** kwargs ,
11956
11955
) -> Series | Any :
11956
+ """
11957
+ Return unbiased standard error of the mean over requested axis.
11958
+
11959
+ Normalized by N-1 by default. This can be changed using the ddof argument
11960
+
11961
+ Parameters
11962
+ ----------
11963
+ axis : {index (0), columns (1)}
11964
+ For `Series` this parameter is unused and defaults to 0.
11965
+
11966
+ .. warning::
11967
+
11968
+ The behavior of DataFrame.sem with ``axis=None`` is deprecated,
11969
+ in a future version this will reduce over both axes and return a scalar
11970
+ To retain the old behavior, pass axis=0 (or do not pass axis).
11971
+
11972
+ skipna : bool, default True
11973
+ Exclude NA/null values. If an entire row/column is NA, the result
11974
+ will be NA.
11975
+ ddof : int, default 1
11976
+ Delta Degrees of Freedom. The divisor used in calculations is N - ddof,
11977
+ where N represents the number of elements.
11978
+ numeric_only : bool, default False
11979
+ Include only float, int, boolean columns. Not implemented for Series.
11980
+ **kwargs :
11981
+ Additional keywords passed.
11982
+
11983
+ Returns
11984
+ -------
11985
+ Series or DataFrame (if level specified)
11986
+ Unbiased standard error of the mean over requested axis.
11987
+
11988
+ See Also
11989
+ --------
11990
+ DataFrame.var : Return unbiased variance over requested axis.
11991
+ DataFrame.std : Returns sample standard deviation over requested axis.
11992
+
11993
+ Examples
11994
+ --------
11995
+ >>> s = pd.Series([1, 2, 3])
11996
+ >>> s.sem().round(6)
11997
+ 0.57735
11998
+
11999
+ With a DataFrame
12000
+
12001
+ >>> df = pd.DataFrame({"a": [1, 2], "b": [2, 3]}, index=["tiger", "zebra"])
12002
+ >>> df
12003
+ a b
12004
+ tiger 1 2
12005
+ zebra 2 3
12006
+ >>> df.sem()
12007
+ a 0.5
12008
+ b 0.5
12009
+ dtype: float64
12010
+
12011
+ Using axis=1
12012
+
12013
+ >>> df.sem(axis=1)
12014
+ tiger 0.5
12015
+ zebra 0.5
12016
+ dtype: float64
12017
+
12018
+ In this case, `numeric_only` should be set to `True`
12019
+ to avoid getting an error.
12020
+
12021
+ >>> df = pd.DataFrame({"a": [1, 2], "b": ["T", "Z"]}, index=["tiger", "zebra"])
12022
+ >>> df.sem(numeric_only=True)
12023
+ a 0.5
12024
+ dtype: float64
12025
+ """
11957
12026
result = super ().sem (
11958
12027
axis = axis , skipna = skipna , ddof = ddof , numeric_only = numeric_only , ** kwargs
11959
12028
)
0 commit comments