w3resource

Pandas DataFrame: plot.hist() function

DataFrame.plot.hist() function

The plot.hist() function is used to draw one histogram of the DataFrame’s columns.

A histogram is a representation of the distribution of data. This function groups the values of all given Series in the DataFrame into bins and draws all bins in one matplotlib.axes.Axes. This is useful when the DataFrame’s Series are in a similar scale.

Syntax:

DataFrame.plot.hist(self, by=None, bins=10, **kwargs)

Parameters:

Name Description Type/Default Value Required / Optional
by                Column in the DataFrame to group by. str or sequence Optional
bins    Number of histogram bins to be used. int
Default Value: 10
Required
**kwds Additional keyword arguments are documented in DataFrame.plot().   Required

Returns: class:matplotlib.AxesSubplot
Return a histogram plot.

Example:


Download the Pandas DataFrame Notebooks from here.

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



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/pandas/dataframe/dataframe-plot-hist.php