[Numpy-discussion] Producing a Histogram When Bins Are Known

josef.pktd@gmai... josef.pktd@gmai...
Thu Nov 26 23:39:29 CST 2009


On Fri, Nov 27, 2009 at 12:16 AM, Wayne Watson
<sierra_mtnview@sbcglobal.net> wrote:
> I have a list that already has the frequencies from 0 to 255. However,
> I'd like to make a histogram  that has say 32 bins whose ranges are 0-7,
> 8-15, ... 248-255. Is it possible?

If they have equal sized (width) bins, then you should be able to
reshape and sum up

frequ.reshape((-1,8)).sum(1)

or something like this,
If the bins have different interval widths, then it might be a bit
trickier to do it without loop.

Josef


>
> --
>           Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
>
>             (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
>              Obz Site:  39° 15' 7" N, 121° 2' 32" W, 2700 feet
>
>                   350 350 350 350 350 350 350 350 350 350
>                     Make the number famous. See 350.org
>            The major event has passed, but keep the number alive.
>
>                    Web Page: <www.speckledwithstars.net/>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>


More information about the NumPy-Discussion mailing list