Box plot of company revenues
You have been contracted by a New York Stock exchange firm who are interested in upping their data visualization capabilities.
They are cautious about this new technology so have tasked you with something simple first. 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.
This exercise is part of the course
Introduction to Data Visualization with Plotly in Python
Exercise instructions
- Examine the head of the provided
revenues
DataFrame that has been printed for you to see what it contains. - Create a simple 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.
Hands-on interactive exercise
Have a go at this exercise by completing this sample 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()