This repository contains a set of Python automation exercises covering file handling, CSV processing, backups, machine learning, and API workflows.
- Create and activate a virtual environment from the repository root.
- Install the common dependencies:
pip install pandas scikit-learn joblib fastapi uvicorn requests prefect- Run commands from the
automation_projects/root so the relative paths in the scripts resolve correctly.
project1_rename/- rename files in thedownloads/folder by normalizing file namesproject2_mover/- move mixed file types into organized subfoldersproject3_api/- stores raw country data pulled from an APIproject3_csv/- combine, clean, and analyze sales CSV dataproject4_backup/- create timestamped zip backups with rotation and loggingproject5_ml/- train and use a revenue prediction modelproject6_api/- FastAPI app that serves the trained modelproject7_prefect/- Prefect flow that fetches country data and retrains the model
Normalize the file names inside project1_rename/downloads/:
python project1_rename/renamefiles.pyOrganize the files inside project2_mover/mixed_files/ into type-based folders:
python project2_mover/file_organizer.pyCombine the monthly sales files, then clean and inspect the data:
python project3_csv/combine_sales.py
python project3_csv/cleaner.py
python project3_csv/sales_exercises.pycombine_sales.py writes combined_sales.csv and summary_report.json. cleaner.py reads messy_sales.csv and produces cleaned_sales.csv plus cleaning_report.json.
Create a timestamped zip backup of the automation_projects/ folder and update the backup log:
python project4_backup/backup_system.pyTrain the revenue model on the cleaned sales data:
python project5_ml/train.pyRun a prediction from the saved model:
python project5_ml/predict.py --units 500 --price 250 --item "Cosmetics" --channel Online --priority H --month 6You can also run python project5_ml/predict.py with no arguments to see sample predictions.
Start the FastAPI app with Uvicorn:
uvicorn project6_api.api:app --reloadThen open:
http://127.0.0.1:8000/for the API roothttp://127.0.0.1:8000/docsfor interactive API docs
Run the Prefect flow:
python project7_prefect/pipeline.pyThe flow fetches country data, retrains the model, and writes a run report under project7_prefect/reports/.
- Generated caches and local virtual environments are ignored via
.gitignore. - The ML and API projects expect the model files in
project5_ml/models/. - If you change any input CSVs, rerun the CSV pipeline before retraining the model.