...

/

Challenge 1: Sales Data Analysis

Challenge 1: Sales Data Analysis

Test your data manipulation skills with the sales dataset in pandas and Matplotlib.

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.

Press + to interact
Python 3.10.4
Files

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.

Press + to interact
Python 3.10.4
Files

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:

...