# How do I get a count of values based on custom bucket-ranges I create for a select column in dataframe?

I have a column in my dataset by name 'production_output' whose values are integers in the range of 2.300000e+01 to 1.110055e+08.

I want to arbitrarily split the values in this column into different buckets based on say, percentile ranges like say [0, 25, 50, 75, 100] and get count of the length of each of theses buckets.

How do I do this using python data-science packages?

• Your asking how to compute a histogram. – kbrose Apr 29 '18 at 20:51
• pandas.DataFrame.quantile – Emre Apr 29 '18 at 21:49
• @kbrose, you are correct. What I'm essentially asking is the background computations done for histogram. And I'm so asking, because I don't see a way to pass parameters to histogram function to get things or am I missing something here? – karthiks Apr 30 '18 at 6:45
• To that guy who down-voted this question without a reason: Why down-voting this question without giving any reason? What a way to help your community members? If you can't help, at least get out of the way from mothers answering this question. – karthiks Apr 30 '18 at 9:37
• I did not downvote, but your question does not show much research. I’m not saying you didn’t research, but there’s no evidence in your question. Maybe it would have been improved by you saying what you tried, what you googled already, etc. – kbrose Apr 30 '18 at 12:38

numpy.histogram
Use numpy.percentile to get the bin edges you desire.