Skip to content

Commit

Permalink
Update canonical.py
Browse files Browse the repository at this point in the history
update read pems crosswalk
  • Loading branch information
vamerlynck committed Jan 11, 2024
1 parent 6ce8500 commit 0898497
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions tm2py/acceptance/canonical.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import pandas as pd
import toml
import geopandas as gpd


class Canonical:
Expand All @@ -27,7 +28,6 @@ class Canonical:
PARK_AND_RIDE_ACCESS_WORD = "Park and Ride"
KISS_AND_RIDE_ACCESS_WORD = "Kiss and Ride"
BIKE_ACCESS_WORD = "Bike"

ALL_VEHICLE_TYPE_WORD = "All Vehicles"
LARGE_TRUCK_VEHICLE_TYPE_WORD = "Large Trucks"

Expand Down Expand Up @@ -198,12 +198,12 @@ def _read_standard_transit_to_survey_crosswalk(self):

return

def aggregate_line_names_across_time_of_day(
self, input_df: pd.DataFrame, input_column_name: str
def aggregate_line_names_across_time_of_day(
self, input_df: pd.DataFrame, input_column_name: str
) -> pd.DataFrame:

df = input_df[input_column_name].str.split(pat="_", expand=True).copy()
df["daily_line_name"] = df[0] + "_" + df[1] + "_" + df[2]
df["daily_line_name"] = df[0] + "_" + df[1] + "_" + df[2]
return_df = pd.concat([input_df, df["daily_line_name"]], axis="columns")

return return_df
Expand All @@ -225,12 +225,6 @@ def _read_pems_to_link_crosswalk(self) -> pd.DataFrame:

df = pd.read_csv(os.path.join(file_root, in_file))

df["pems_station_id"] = df["station"].astype(str) + "_" + df["direction"]

assert df["pems_station_id"].is_unique # validate crosswalk - correct location?

df = df[["pems_station_id", "A", "B"]]

self.pems_to_link_crosswalk_df = df

return
Expand Down

0 comments on commit 0898497

Please sign in to comment.