CommencerCommencer gratuitement

Box plot of company revenues

You have been contracted by a New York Stock Exchange firm that is interested in improving its data visualization capabilities.

They are cautious about this new technology, so they first tasked you to display the distribution of the revenues of top companies in the USA. They are particularly interested in what kind of revenue puts you in the 'top bracket' of companies.

They also want to know if there are any outliers and how they can explore this in the plot. This sounds like a perfect opportunity for a box plot.

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

There is a revenues DataFrame already loaded for your use.

Cet exercice fait partie du cours

Introduction to Data Visualization with Plotly in Python

Afficher le cours

Instructions

  • Examine the head of the provided revenues DataFrame that has been printed for you.
  • Create a box plot, setting the appropriate y-axis for company revenue data.
  • Set the hover_data (a list of one string value) to show the company name.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Create the box plot
fig = px.____(
  			# Set the data
  			data_frame=____, 
  			# Set the y variable
            y=____, 
            # Add in hover data to see outliers
            hover_data=[____])

# Show the plot
fig.show()
Modifier et exécuter le code