Trip Stats¶
-
gtfs_utils.core_computations.compute_trip_stats(feed: partridge.gtfs.feed, zones: pandas.core.frame.DataFrame, clusters: pandas.core.frame.DataFrame, trip_to_date: pandas.core.frame.DataFrame, date: datetime.date, source_files_base_name: List[str]) → pandas.core.frame.DataFrame¶ Parameters: - feed – Partridge feed for the specific date
- zones – DataFrame with stop_code to zone_name mapping
- trip_to_date – trip_id_to_date information to match with the feed data
- date – The original schedule date
- source_files_base_name – The original zips the data is based on (GTFS, Tariff, etc.)
Raise: pandas.MergeError if trip_id_to_date will not merge as 1:1 with trip data
Returns: A DataFrame with columns as described below
Trip stats table has the following columns:
agency_id- Agency identifier, as specified in agency.txt file.agency_name- The full name of the agency, as specified in agency.txt file.all_stop_code- All stop codes (as specified in stops.txt file), separated by semicolons.all_stop_desc_city- Cities of all stops of the trip (as described in stop_desc field in stops.txt file), separated by semicolons.all_stop_id- All stop identifiers (as specified in stops.txt file), separated by semicolons.all_stop_latlon- All stop waypoints (stop_lat and stop_lon as specified in stops.txt file), formatted as lat,lon and separated by semicolons.cluster_id- Cluster code, as in ClusterId in ClusterToLine file.cluster_name- The name of the cluster to which the line belongs, as in ClusterName in ClusterToLine file.cluster_sub_desc- A sub-cluster name to which the line is associated, as in ClusterSubDesc in ClusterToLine file.date- The original schedule datedirection_id- Indicates the direction of travel for a trip, as specified in trips.txt file.distance- The full travel distance of the trip in meters, which is the maximal shape_dist_traveled, as specified in stop_times.txt file.duration- Duration of the trip in hoursend_stop_city- The city of the last stop of the trip, as described in stop_desc field in stops.txt file.end_stop_code- Stop code of the last stop of the tripend_stop_desc- The description of the last stop of the trip, as described as stop_desc field in stops.txt file.end_stop_id- Stop ID of the last stop of the tripend_stop_lat- Latitude of the last stop of the tripend_stop_lon- Longitude of the last stop of the tripend_stop_name- Stop name of the last stop of the tripend_time- Departure time of the last stop of the tripend_zone- Zone name of the last stop of the tripsource_files- The original the data is based on (GTFS, Tariff, etc.)is_loop- 1 if the start and end stop are less than 400m apart, otherwise 0line_type- Line type code, as in LineType in ClusterToLine file.line_type_desc- Line type description, as in LineTypeDesc in ClusterToLine file. The options for this fields are:- “עירוני” - Urban
- “בינעירוני” - Intercity
- “אזורי” - Regional
num_stops- Number of stops in tripnum_zones- Number of zones where the trip stops are. Zones are defined in the files in Tariff.zip.num_zones_missing- Number of stops whose identifier is missing from the files in Tariff.zip.route_alternative- A route’s alternative identifier. Constructs a route identifier together withroute_directionandroute_mkt.route_direction- A route’s direction identifier. Constructs a route identifier together withroute_alternativeandroute_mkt.route_id- Route identifier, as specified in routes.txt file.route_long_name- The full name of a route, as specified in routes.txt file.route_mkt- MOT Line’s 5-digit catalog number (”מק”ט”), a unique number at the line level, but not unique at the alternative level. Constructs a route identifier together withroute_directionandroute_alternative.route_short_name- The short name of a route, as specified in routes.txt file.route_type- The type of transportation used on a route, as specified in routes.txt. In Israel, MOT uses:- 0 for light train (Jerusalem Light Rail)
- 2 for train (Israel Railways)
- 3 for bus
- 715 for Flexible Service Line (“קו בשירות גמיש”)
shape_id- Shape identifier, as specified in shapes.txt file.source_files- base name of the files the data is based on (as they are saved on S3).speed- Average speed of the trip in meters per hour (calculated as distance/duration).start_stop_city- The city of the first stop of the trip, as specified in stop_desc field in stops.txt file.start_stop_code- Stop code of the first stop of the tripstart_stop_desc- The description of the first stop of the trip, as described as stop_desc field in stops.txt file.start_stop_id- Stop ID of the first stop of the tripstart_stop_lat- Latitude of the first stop of the tripstart_stop_lon- Longitude of the first stop of the tripstart_stop_name- Stop name of the first stop of the tripstart_time- Departure time of the first stop of the tripstart_zone- Zone name of the first stop of the triptrip_id- Trip identifier, as specified in trips.txt file.trip_id_to_date- Trip identifier that is unique for each day in week and departure hour.