This project is designed to analyze sales data from a CSV file, calculate profits, and visualize the data to provide insights into the sales and profit trends over time.
csv
: For reading and writing CSV files.pandas
: Used for data manipulation and analysis.plotly.express
: For creating interactive charts and graphs for data visualization.
The project performs several key operations on the sales data:
- Reads sales data from a CSV file.
- Calculates total sales across all months.
- Extends the project to calculate profit (sales - expenditure) for each month, adding this data as a new column in the CSV.
- Calculates the total profit across all months.
- Identifies the maximum and minimum sales and profit values across all months.
- Visualizes the profit across all months using a line graph.
- Offers the option to display additional graphs for sales and expenditure on demand.
This project uses Plotly Express to create dynamic and interactive visualizations. Specifically, it features:
- A line graph showing profits across all months, which helps in understanding the profit trends over time.
- On-demand generation of line graphs for sales and expenditure, allowing for a deeper dive into the financial performance of the company.
Ensure you have the required libraries installed:
pip install pandas plotly
Run the script in a Python environment. The script will prompt you to choose whether you want to display additional graphs for sales and expenditure.
The script operates on a sales.csv
file, which must include the columns month
, sales
, and expenditure
. Ensure this file is in the same directory as the script for it to run correctly.
This project offers a comprehensive analysis and visualization of sales data, providing valuable insights into the company's financial performance over time.