This archive contains the finalized individual project completed during the 2022-2023 session of the "Research Software Engineering with Python" module.
This individual project asks you to create some classes and functions to load and process a CSV dataset. You will also need to create some tests and commit your work as you progress in a git repository
-
Install Dependencies:
- Make sure you have Python installed on your system.
- Install required dependencies by running:
pip install cities matplotlib
-
Prepare Data:
- Ensure your attendee data is stored in a CSV file with the following columns:
- Number of attendees
- Country
- City
- Latitude
- Longitude
- Distance
- Ensure your attendee data is stored in a CSV file with the following columns:
-
Run the Script:
- Run the script
main.py
with Python:python main.py
- Run the script
-
Output:
- The script will read the attendee data, perform analysis, and display summaries and visualizations, including top emitters from a specified city.
from cities import City
from utils import read_attendees_file
if __name__ == "__main__":
# File path
filepath = 'attendee_locations.csv'
# Read city collection
col = read_attendees_file(filepath)
# Example usage (choose Zurich as a travel destination)
zurich = City('Zurich', 'Switzerland', 52, 47.22, 8.33)
col.summary(zurich)
col.plot_top_emitters(city=zurich, n=8, save=True)
Host city: Zurich (Switzerland)
Total CO2: 48488190 tonnes
Total attendees travelling to Zurich from 1766 different cities: 24008