Devendra.j
Devendra.j

Reputation: 31

Meaning of Bins in Python?

What is meaning of bins=50 while making histogram and the role of BIN in Boxplot.

df['ApplicantIncome'].hist(bins=50)

Thanks & Regards

Upvotes: 2

Views: 17612

Answers (1)

Udayan Tandon
Udayan Tandon

Reputation: 41

To construct a histogram, the first step is to "bin" (or "bucket") the range of values—that is, divide the entire range of values into a series of intervals.

More information here: https://en.wikipedia.org/wiki/Histogram

Thus if you choose bins equal to 50 then your input will be divided into 50 intervals or bins if possible.

In matplotlib you can also let it automatically generate bins in the latest version given your data or you can give custom sequences as well.

More specific information about matplotlib for bins can be found here: https://matplotlib.org/api/_as_gen/matplotlib.pyplot.hist.html

Upvotes: 4

Related Questions