Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8776809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:08:34+00:00 2026-06-13T19:08:34+00:00

I have some values in a Python Pandas Series (type: pandas.core.series.Series ) In [1]:

  • 0

I have some values in a Python Pandas Series (type: pandas.core.series.Series)

In [1]: series = pd.Series([0.0,950.0,-70.0,812.0,0.0,-90.0,0.0,0.0,-90.0,0.0,-64.0,208.0,0.0,-90.0,0.0,-80.0,0.0,0.0,-80.0,-48.0,840.0,-100.0,190.0,130.0,-100.0,-100.0,0.0,-50.0,0.0,-100.0,-100.0,0.0,-90.0,0.0,-90.0,-90.0,63.0,-90.0,0.0,0.0,-90.0,-80.0,0.0,])

In [2]: series.min()
Out[2]: -100.0

In [3]: series.max()
Out[3]: 950.0

I would like to get values of histogram (not necessary plotting histogram)… I just need to get the frequency for each interval.

Let’s say that my intervals are going from [-200; -150] to [950; 1000]

so lower bounds are

lwb = range(-200,1000,50)

and upper bounds are

upb = range(-150,1050,50)

I don’t know how to get frequency (the number of values that are inside each interval) now…
I’m sure that defining lwb and upb is not necessary… but I don’t know what
function I should use to perform this!
(after diving in Pandas doc, I think cut function can help me because it’s a discretization problem… but I’m don’t understand how to use it)

After being able to do this, I will have a look at the way to display histogram (but that’s an other problem)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T19:08:35+00:00Added an answer on June 13, 2026 at 7:08 pm

    You just need to use the histogram function of NumPy:

    import numpy as np
    count, division = np.histogram(series)
    

    where division is the automatically calculated border for your bins and count is the population inside each bin.

    If you need to fix a certain number of bins, you can use the argument bins and specify a number of bins, or give it directly the boundaries between each bin.

    count, division = np.histogram(series, bins = [-201,-149,949,1001])
    

    to plot the results you can use the matplotlib function hist, but if you are working in pandas each Series has its own handle to the hist function, and you can give it the chosen binning:

    series.hist(bins=division)
    

    Edit:
    As mentioned by another poster, Pandas is built on top of NumPy. Since OP is explicitly using Pandas, we can do away with the additional import by accessing NumPy through Pandas:

    count, division = pd.np.histogram(series)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have this code in python that writes some values to a Dictionary
I have a python module. I want to populate some values to it at
I have some code in python, that bitwise or-equals b to all the values
I have a Python pandas DataFrame rpt : rpt <class 'pandas.core.frame.DataFrame'> MultiIndex: 47518 entries,
I currently have some code in Python where I have entered the values from
I have an array A on python that has some nan values created by
I have some values in a dataframe called 'values' ie: Sam Ned Ted Ann
I have some values in a configuration file (XML file) with some values like
In my C++ application, I have some values that act as codes to represent
I have some default values for testing my code, but for security reasons those

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.