Skip to content

Commit

Permalink
dropped interpolated_times empty check, it over complicates the funct…
Browse files Browse the repository at this point in the history
…ion just to skip the merge step, when there really is not significant perf gains to be achieved through this
  • Loading branch information
kuanb committed Apr 20, 2017
1 parent b7c32d6 commit 7979189
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions urbanaccess/gtfs/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,19 +306,9 @@ def interpolatestoptimes(stop_times_df, calendar_selected_trips_df, day):
interpolated_df.set_index('index', inplace=True)
interpolated_times = interpolated_df[['departure_time_sec_interpolate']]

# default value for final_stop_times
final_stop_times_df = stop_times_df

# if empty just duplicate departure_time_sec col
if interpolated_times.empty:
departures = final_stop_times_df['departure_time_sec'].copy()
final_stop_times_df['departure_time_sec_interpolate'] = departures

# if df not empty, override the default final_stop_times with merge result
else:
final_stop_times_df = pd.merge(stop_times_df, interpolated_times,
how='left', left_index=True,
right_index=True, sort=False, copy=False)
final_stop_times_df = pd.merge(stop_times_df, interpolated_times,
how='left', left_index=True,
right_index=True, sort=False, copy=False)

# fill in nulls in interpolated departure time column using trips that did not need interpolation in order to create
# one column with both original and interpolated times
Expand Down

0 comments on commit 7979189

Please sign in to comment.