Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags


What are bootstrap plots in pandas?


Bootstrap plots

Any test or metric that employs random sampling with replacement—such as to simulate the sampling process—is referred to as bootstrapping and belongs to the broader category of resampling procedures. By relying on random sampling with replacement, the bootstrap plot is used to assess the uncertainty of a statistic. In other words, it’s a technique for determining the uncertainty in fundamental statistics like mean and median by resampling the data with replacement.

The bootstrap_plot() function

The bootstrap_plot() function will generate bootstrapping plots for mean, median, and mid-range statistics for the given number of samples of the given size.

Function signature

pandas.plotting.bootstrap_plot(series, fig=None, size=50, samples=500, **kwds)


  • series: This is the series from which samples are drawn.
  • fig: Matplotlib’s figure can be specified here. Otherwise, a new one will be created.
  • size: This is the sample size to draw for each sampling process.
  • samples: This is the number of times the bootstrap procedure/sampling is performed.


import pandas as pd
import seaborn as sns

df = sns.load_dataset("geyser")

pd.plotting.bootstrap_plot(df['waiting'],size = 50 , samples = 500).show()


  • Line 4: We use the load_dataset() function in seaborn to load the "geyser" dataset into memory as a DataFrame.
  • Line 6: A bootstrap plot is plotted on the waiting column of the DataFrame with the sample size as 50 and the number of samples as 500.



View all Courses

Keep Exploring