Closed
Description
Should I write a Series.histogram
that calls numpy.histogram
and returns a new Series of counts indexed by bins?
In [4]: s = Series(randn(100))
In [5]: counts, bins = np.histogram(s)
In [6]: Series(counts, index=bins[:-1])
Out[6]:
-2.968575 1
-2.355032 4
-1.741488 5
-1.127944 26
-0.514401 23
0.099143 23
0.712686 12
1.326230 5
1.939773 0
2.553317 1
dtype: int32
...would be accomplished by...
Series.histogram()
which would accept at the arguments that np.histogram
accepts (e.g., choosing bins manually, specifying number or range of bins, etc.).
from http://stackoverflow.com/a/17150734/1221924
The proposed method doesn't save all that much typing, but it would help users discover this convenient way of storing a histogram. Proceed?