-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ENH: Add Series.histogram() #3945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
What you are proposing is basically this
|
That's new to me. Not sure which output is more valuable for whatever users would do next. |
yours more friendly for plotting |
@jreback cut returns string row labels, right? |
it returns a Categorical which has both labels and levels |
would this be more useful as a top level function instead of a method?
|
I think an instance method on series is about right (but maybe using groupy and cut as above) |
I don't have strong feelings about this. It's certainly easy to work around, but I really hate working with Categoricals. |
problem is np.histogram doesn't like nan |
or u can just get the bins from cut cat, bins = cut(s, 10, retbins=True)
s = Series(cat.values, index=bins[:-1], name=cat.name) not sure if |
confusing having different hist and histogram methods... perhaps this could be an argument (bins) to value_counts ? |
Good idea.
|
This is pretty easy, pr on the way, will also add more functionality to Series.value_counts which was never updated from pd.value_counts. |
Should I write a
Series.histogram
that callsnumpy.histogram
and returns a new Series of counts indexed by bins?...would be accomplished by...
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?
The text was updated successfully, but these errors were encountered: