From 4a7a09fce7c2f236360bb702aae82f24fa9e669a Mon Sep 17 00:00:00 2001 From: Nahuel Lofeudo Date: Sun, 23 Apr 2023 07:14:47 +0100 Subject: [PATCH] Correct arrival and departure dates (h:mm:ss -> hh:mm:ss) --- gtfs_client.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gtfs_client.py b/gtfs_client.py index dd74999..b2f51a1 100644 --- a/gtfs_client.py +++ b/gtfs_client.py @@ -90,6 +90,9 @@ class GTFSClient(): df = pd.concat([chunk[chunk["stop_id"].isin(wanted_stop_ids)] for chunk in iter_csv]) if not df.empty: + # Fix arrival and departure times so that comparisons work the way they are expected to + df["arrival_time"] = df.apply(lambda row: row["arrival_time"] if len(row["arrival_time"]) == 8 else "0"+row["arrival_time"], axis=1) + df["departure_time"] = df.apply(lambda row: row["departure_time"] if len(row["departure_time"]) == 8 else "0"+row["departure_time"], axis=1) feed_dict["stop_times"] = gk.cn.clean_column_names(df) feed_dict["dist_units"] = dist_units