Search⌘ K
AI Features

Challenge 1: Sales Data Analysis

Explore how to analyze sales data using Python by loading datasets with pandas, performing data manipulation and calculations, defining performance metrics, and visualizing results through various plots.

In this exercise, use the pandas and Matplotlib libraries to analyze sales data from a CSV file. You’ll perform the following tasks.

Task 1: Load the dataset

Load the data into a pandas DataFrame using the pd.read_csv function and store it in a variable called sales_data. The file name is Sales-Data.csv. Display the first five rows of the data at the end.

Python 3.10.4

Task 2: Plot the data

Create a bar plot showing total sales for each product. Use the groupby and sum functions from pandas to calculate the total sales.

Python 3.10.4

Task 3: Manipulate the data

Create a new column in sales_data called Profit Margin that contains the calculated profit margin values using the formula:

...