Write a script to process a dataset ('sample_dataset.csv'). The dataset contains the following columns:
['OrderID', 'Date', 'Region', 'Sales', 'Profit'].
The script should:
- Calculate and display:
- Total sales.
- Total profit.
- The region with the highest sales.
- Group the data by region and output the total sales and profit for each region.
- Save a report (JSON or CSV) summarizing the above data.
- Use any language or libraries (e.g., Python + Pandas, JavaScript, etc.).
- The script should handle basic errors (e.g., missing/incorrect file format).
- The output report should be well-structured.
- Visualize the results with a chart (e.g., bar chart of sales by region).
- Include an option to filter the dataset by date range or region.
- Write basic tests to validate key functions.
This project is built on python version ( 3.13.1 )
You will find the required librarys in 'requirements.txt'
To install python, go to python website, download and install python 3.13.1 (or newer version)
To install dependensies, in your shell , write pip install -r requirements.txt or pip3 install -r requirements.txt
Now everything should be installed and ready to go.
I have prepared an example file 'example_usage.py'.
Run this in your shell:
python test_data_processor.py or python3 test_data_processor.py
to try out the function of the class
Basic testing is written in unittest, theese are found in 'test_data_processor.py'
Run tests by writing in your shell:
python test_data_processor.py or python3 test_data_processor.py
I used jupyter notebooks as scratchpad for this assignment, take a look at my notes in thought_process.ipynb.