Choosing the number of bins in a histogram has always been something that gets me thinking a lot. Based on the number of bins chosen, the graph at time looks a lot different and also could lead to different interpretations.
Below is the square-root rule, which I use as the thumb-rule for selecting the number of bins in most occasions.
Posting this question here to hear other opinions.
data_pts = len(np.array(data)) bin_cnt = int(np.sqrt(data_pts)) plt.hist(data, bins=bin_cnt)