Skip to content

Commit d5a7d35

Browse files
committed
fix mypy error; save deadhead trip durations as float rather than int
1 parent f80b1ab commit d5a7d35

1 file changed

Lines changed: 10 additions & 18 deletions

File tree

nrel/routee/transit/predictor.py

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -452,15 +452,11 @@ def add_mid_block_deadhead(self) -> Self:
452452
)
453453

454454
deadhead_trip_times["trip_duration_minutes"] = (
455-
(
456-
(
457-
deadhead_trip_times["end_time"] - deadhead_trip_times["start_time"]
458-
).dt.total_seconds()
459-
/ 60
460-
)
461-
.round()
462-
.astype(int)
463-
)
455+
pd.to_timedelta(
456+
deadhead_trip_times["end_time"] - deadhead_trip_times["start_time"]
457+
).dt.total_seconds()
458+
/ 60
459+
).round(2)
464460

465461
# Convert start/end times to GTFS-style strings
466462
def format_timedelta(td: pd.Timedelta) -> str:
@@ -602,15 +598,11 @@ def add_depot_deadhead(self) -> Self:
602598
)
603599

604600
deadhead_trip_times["trip_duration_minutes"] = (
605-
(
606-
(
607-
deadhead_trip_times["end_time"] - deadhead_trip_times["start_time"]
608-
).dt.total_seconds()
609-
/ 60
610-
)
611-
.round()
612-
.astype(int)
613-
)
601+
pd.to_timedelta(
602+
deadhead_trip_times["end_time"] - deadhead_trip_times["start_time"]
603+
).dt.total_seconds()
604+
/ 60
605+
).round(2)
614606

615607
# Convert start/end times to GTFS-style strings
616608
def format_timedelta(td: pd.Timedelta) -> str:

0 commit comments

Comments
 (0)