'How to plot a histogram plot for describing a wealth distribution? matplotlib

I have a long list of accounts with a balance amount, i.e.

jenny 1,030,234
ben   1,000,000
alex    921,034
jane     30,232
max      10,233
...
...

I want to create a histogram with 100 bins (each bin = # total accounts / 100), each bin is the sum of balance of all accounts that belong to the bin, the top cohort all the way to the left. So the histogram will look something like this. x-axis = bins, y-axis = wealth share.

enter image description here

I assume i will have to define

plt.hist(data, bins = 100)

but I was wondering how to divide the array into 100 bins and tell python to sum them up? Any help will be appreciated!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source