@@ -12299,7 +12299,6 @@ def std(
12299
12299
) -> Series | Any : ...
12300
12300
12301
12301
@deprecate_nonkeyword_arguments (version = "3.0" , allowed_args = ["self" ], name = "std" )
12302
- @doc (make_doc ("std" , ndim = 2 ))
12303
12302
def std (
12304
12303
self ,
12305
12304
axis : Axis | None = 0 ,
@@ -12308,6 +12307,82 @@ def std(
12308
12307
numeric_only : bool = False ,
12309
12308
** kwargs ,
12310
12309
) -> Series | Any :
12310
+ """
12311
+ Return sample standard deviation over requested axis.
12312
+
12313
+ Normalized by N-1 by default. This can be changed using the ddof argument.
12314
+
12315
+ Parameters
12316
+ ----------
12317
+ axis : {index (0), columns (1)}
12318
+ For `Series` this parameter is unused and defaults to 0.
12319
+
12320
+ .. warning::
12321
+
12322
+ The behavior of DataFrame.std with ``axis=None`` is deprecated,
12323
+ in a future version this will reduce over both axes and return a scalar
12324
+ To retain the old behavior, pass axis=0 (or do not pass axis).
12325
+
12326
+ skipna : bool, default True
12327
+ Exclude NA/null values. If an entire row/column is NA, the result
12328
+ will be NA.
12329
+ ddof : int, default 1
12330
+ Delta Degrees of Freedom. The divisor used in calculations is N - ddof,
12331
+ where N represents the number of elements.
12332
+ numeric_only : bool, default False
12333
+ Include only float, int, boolean columns. Not implemented for Series.
12334
+ **kwargs : dict
12335
+ Additional keyword arguments to be passed to the function.
12336
+
12337
+ Returns
12338
+ -------
12339
+ Series or scalar
12340
+ Standard deviation over requested axis.
12341
+
12342
+ See Also
12343
+ --------
12344
+ Series.std : Return standard deviation over Series values.
12345
+ DataFrame.mean : Return the mean of the values over the requested axis.
12346
+ DataFrame.mediam : Return the mediam of the values over the requested axis.
12347
+ DataFrame.mode : Get the mode(s) of each element along the requested axis.
12348
+ DataFrame.sum : Return the sum of the values over the requested axis.
12349
+
12350
+ Notes
12351
+ -----
12352
+ To have the same behaviour as `numpy.std`, use `ddof=0` (instead of the
12353
+ default `ddof=1`)
12354
+
12355
+ Examples
12356
+ --------
12357
+ >>> df = pd.DataFrame(
12358
+ ... {
12359
+ ... "person_id": [0, 1, 2, 3],
12360
+ ... "age": [21, 25, 62, 43],
12361
+ ... "height": [1.61, 1.87, 1.49, 2.01],
12362
+ ... }
12363
+ ... ).set_index("person_id")
12364
+ >>> df
12365
+ age height
12366
+ person_id
12367
+ 0 21 1.61
12368
+ 1 25 1.87
12369
+ 2 62 1.49
12370
+ 3 43 2.01
12371
+
12372
+ The standard deviation of the columns can be found as follows:
12373
+
12374
+ >>> df.std()
12375
+ age 18.786076
12376
+ height 0.237417
12377
+ dtype: float64
12378
+
12379
+ Alternatively, `ddof=0` can be set to normalize by N instead of N-1:
12380
+
12381
+ >>> df.std(ddof=0)
12382
+ age 16.269219
12383
+ height 0.205609
12384
+ dtype: float64
12385
+ """
12311
12386
result = super ().std (
12312
12387
axis = axis , skipna = skipna , ddof = ddof , numeric_only = numeric_only , ** kwargs
12313
12388
)
0 commit comments