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
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework