w3resource

Pandas DataFrame: plot.density() function

DataFrame-plot-density() function

The plot.density() function is used to generate Kernel Density Estimate plot using Gaussian kernels.

In statistics, kernel density estimation (KDE) is a non-parametric way to estimate the probability density function (PDF) of a random variable. This function uses Gaussian kernels and includes automatic bandwidth determination.

Syntax:

DataFrame.plot.density(self, bw_method=None, ind=None, **kwargs)

Parameters:

Name Description Type/Default Value Required / Optional
bw_method  The method used to calculate the estimator bandwidth. This can be ‘scott’, ‘silverman’, a scalar constant or a callable. If None (default), ‘scott’ is used. str, scalar or callable Optional
ind  Evaluation points for the estimated PDF. If None (default), 1000 equally spaced points are used. If ind is a NumPy array, the KDE is evaluated at the points passed. If ind is an integer, ind number of equally spaced points are used. NumPy array or integer Optional
**kwds  Additional keyword arguments are documented in pandas.%(this-datatype)s.plot().   Optional

Returns: matplotlib.axes.Axes or numpy.ndarray of them

Example:


Download the Pandas DataFrame Notebooks from here.

Previous: DataFrame.plot.box() function
Next: DataFrame.plot.hexbin() function



Follow us on Facebook and Twitter for latest update.