Python: how to make an histogram with equally *sized* bins
I have a set of data, and want to make an histogram of it. I need the bins to have the same size , by which I mean that they must contain the same number of objects, rather than the more common (numpy.histogram) problem of having equally spaced bins. This will naturally come at the expenses of the bins widths, which can - and in general will - be different. I will specify the number of desired bins and the data set, obtaining the bins edges in return. Example: data = numpy.array([1., 1.2, 1.3, 2.0, 2.1, 2.12]) bins_edges = somefunc(data, nbins=3) print(bins_edges) >> [1.,1.3,2.1,2.12] So the