FAQ: Histograms - Histograms

This community-built FAQ covers the “Histograms” exercise from the lesson “Histograms”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Learn Statistics With Python

FAQs on the exercise Histograms

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

1 Like

Hi everyone,

I cannot proceed from this page in the Histogram module:

https://www.codecademy.com/paths/data-science/tracks/dscp-summary-statistics/modules/dscp-distributions/lessons/intro-to-histograms/exercises/numpy-histograms

It stops with an error message of “page unresponsive”. A screenshot is below. I have tried it in the past three days, and it’s not a matter of downtime on the Codeacademy website.

Screen Shot 2021-08-27 at 08.13.44

Hi there, I am having this same problem. @codecademy , please assist? Thank you!


Works for me?

Why can a range( ) object not be used as the range argument in np.histogram( values, range, bins) ?
This causes an error:
times_hist = np.histogram(times_np, range = range(0,24), bins=4)
This causes an error too:
times_hist = np.histogram(times_np, range(0,24), bins=4)

This works:
times_hist = np.histogram(times_np, range = (0,24), bins=4)

Can someone explain the argument ‘range’ and how it works on the back end?

Documentation is almost always a great place to explore details such as parameters, return values, examples, special remarks etc.

Documentation: numpy.histogram — NumPy v1.24 Manual

As you can see, range is one of the optional named parameters of histogram. It has a default value of None. If we choose to provide an argument for this parameter, it must be in the form (float, float).

scrn1

In this case, it is one of the named parameters and should not be confused with Python’s range sequence type (Built-in Types — Python 3.11.3 documentation)

1 Like