diff --git a/Analyze.py b/Analyze.py index 3f07dbf..1aca83f 100644 --- a/Analyze.py +++ b/Analyze.py @@ -10,11 +10,11 @@ def import_data(): return pd.read_csv('ttc-bus-delay-data-2023.csv') -def compute_avg_delay(data): +def compute_avg_delay(data, group_by: str = 'Route'): """ - Compute the average delay for each route + Compute the average delay aggregated by specified column """ - return data.groupby('Route').mean().reset_index() + return data.groupby('Route')['Min Delay'].mean().reset_index() def main(): @@ -22,7 +22,7 @@ def main(): Main function """ data = import_data() - avg_delay = compute_avg_delay(data) + avg_delay = compute_avg_delay(data, group_by='Route') plt.hist(avg_delay['Min Delay'], bins=30) plt.title('Average Delay Distribution') diff --git a/DSI_git_assignment b/DSI_git_assignment new file mode 160000 index 0000000..ce31e28 --- /dev/null +++ b/DSI_git_assignment @@ -0,0 +1 @@ +Subproject commit ce31e28393811bbc669a05dba9fd34ad8949a5a6