Get startedGet started for free

Histogram of company revenues

The New York Stock Exchange firm loved your previous box plot and wants you to do more work for them.

The box plot was a perfect visualization to help them understand their company revenue dataset's outliers and quartile-related attributes.

However, they want to understand a bit more about the data distribution. Are there many companies with smaller revenue or larger revenue? Is it somewhat bell-shaped or skewed towards higher or lower revenues?

In this exercise, you will help the investment team by creating a histogram of the revenue of top US companies.

There is a revenues DataFrame already loaded for your use.

This exercise is part of the course

Introduction to Data Visualization with Plotly in Python

View Course

Exercise instructions

  • Create a histogram using px.histogram() and the appropriate DataFrame.
  • Set the column Revenue to be used along the x-axis.
  • Set the number of bins to 5.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create a simple histogram
fig = px.histogram(
  			data_frame=____, 
            # Set up the x-axis
           	____="____",
            # Set the number of bins
            ____=____)

# Show the plot
fig.show()
Edit and Run Code