This project demonstrates how to work with a local SQLite database using Python. It covers creating schemas (DDL), loading data from CSV files, and performing SQL queries to analyze traffic violations. It includes both a Python script for automated data processing and a Jupyter Notebook for interactive exploration.
The project explores three entities:
- Drivers: Information about individuals and their vehicle registration.
- Traffic Violations: A log of violation events linking drivers to specific offenses.
- Violations Details: A reference table for types of offenses, points, and fines.
- Python 3.12
- SQLite3: Built-in Python library for database operations.
- Pandas: Data manipulation and analysis.
- Anaconda/Conda: For environment and package management.
- Jupyter Notebook: For interactive data exploration.
This project was created using Anaconda. To ensure all dependencies (like pandas and sqlite) are correctly installed and to avoid version conflicts, please use the provided environment.yml file to rebuild the virtual environment.
Open your terminal or Anaconda Prompt and run:
conda env create -f environment.ymlOnce the installation is complete, activate the new environment:
conda activate sqlite_practiceIf you want to use this environment specifically within a global Jupyter installation, you can register it as a kernel:
python -m ipykernel install --user --name sqlite_practice --display-name "Python (sqlite_practice)"You can run the analysis script:
python sqlite_practice_script.pyOr explore the data interactively using the Jupyter Notebook:
jupyter notebook sqlite_practice.ipynb