Skip to content

Commit 0d86742

Browse files
aydevosotrosTomAugspurger
authored andcommitted
DOC: Improved pandas.plotting.bootstrap_plot docstring (#20166)
* Improved documentation on bootstrap_plot * Improved documentation on bootstrap_plot * Doc bootstrap_plot: Fixed some comments on pull requests * Added reference to wikipedia * Changed kwds for **kwds * Removed ** from kwds becuase of validation iuses * Fixed forgotten break line. I think that the kwds paramater now fits what expected @TomAugspurger. If not, sorry and indicate how it should be * Fixed warnings on compilation * Moved reference to extended description
1 parent a2910ad commit 0d86742

File tree

1 file changed

+39
-8
lines changed

1 file changed

+39
-8
lines changed

pandas/plotting/_misc.py

+39-8
Original file line numberDiff line numberDiff line change
@@ -364,20 +364,51 @@ def f(t):
364364

365365

366366
def bootstrap_plot(series, fig=None, size=50, samples=500, **kwds):
367-
"""Bootstrap plot.
367+
"""
368+
Bootstrap plot on mean, median and mid-range statistics.
369+
370+
The bootstrap plot is used to estimate the uncertainty of a statistic
371+
by relaying on random sampling with replacement [1]_. This function will
372+
generate bootstrapping plots for mean, median and mid-range statistics
373+
for the given number of samples of the given size.
374+
375+
.. [1] "Bootstrapping (statistics)" in \
376+
https://en.wikipedia.org/wiki/Bootstrapping_%28statistics%29
368377
369378
Parameters
370379
----------
371-
series: Time series
372-
fig: matplotlib figure object, optional
373-
size: number of data points to consider during each sampling
374-
samples: number of times the bootstrap procedure is performed
375-
kwds: optional keyword arguments for plotting commands, must be accepted
376-
by both hist and plot
380+
series : pandas.Series
381+
Pandas Series from where to get the samplings for the bootstrapping.
382+
fig : matplotlib.figure.Figure, default None
383+
If given, it will use the `fig` reference for plotting instead of
384+
creating a new one with default parameters.
385+
size : int, default 50
386+
Number of data points to consider during each sampling. It must be
387+
greater or equal than the length of the `series`.
388+
samples : int, default 500
389+
Number of times the bootstrap procedure is performed.
390+
**kwds :
391+
Options to pass to matplotlib plotting method.
377392
378393
Returns
379394
-------
380-
fig: matplotlib figure
395+
fig : matplotlib.figure.Figure
396+
Matplotlib figure
397+
398+
See Also
399+
--------
400+
pandas.DataFrame.plot : Basic plotting for DataFrame objects.
401+
pandas.Series.plot : Basic plotting for Series objects.
402+
403+
Examples
404+
--------
405+
406+
.. plot::
407+
:context: close-figs
408+
409+
>>> import numpy as np
410+
>>> s = pd.Series(np.random.uniform(size=100))
411+
>>> fig = pd.plotting.bootstrap_plot(s)
381412
"""
382413
import random
383414
import matplotlib.pyplot as plt

0 commit comments

Comments
 (0)