[Numpy-discussion] numpy histogram data
ddavis at ddavis.io
Tue Jun 8 10:27:45 EDT 2021
Keith Sloan <keith at sloan-home.co.uk> writes:
> Okay trying to understand the data being returned.
> I have
> counts, bins = np.histogram(RedEllipticalMasses['Z_1'],bins=80)
> If I print lengths I get
> RedEllipticalMasses is 2514
> bins = 81
> and counts is 5
> ( It is 5 Arrays each of length 80)
> Okay I can get centers with
> centers = 0.5 * (bins[1:] + bins[:-1]
> As you advised
> But unclear how I would get their heights and why counts has 5 arrays ?
Not having a clear understanding of your dataset.. I'm not quit sure why
you're seeing the results you described. Nevertheless if you define bins
with an integer, the len(counts) should be equal to that number and len
bins should indeed be that number + 1. Perhaps you have a mistake
somewhere else in your code?
More information about the NumPy-Discussion