Skip to content

How to create a cumulative histogram in Hist? #312

Answered by henryiii
txell-1 asked this question in Q&A
Discussion options

You must be logged in to vote

1D, anyway:

array = np.cumsum(h.values())

If you want a histogram object out, then:

cumsum_hist = h.copy()
cumsum_hist[...] = np.cumsum(h)

You can be explicit and use h.values(), but just h works inside cumsum, as it exposes the interface NumPy expects.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@txell-1
Comment options

Answer selected by txell-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants