Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Reversible mapping of codes/aggregation #548

Open
jpn-- opened this issue Apr 7, 2022 · 0 comments
Open

Feature Request: Reversible mapping of codes/aggregation #548

jpn-- opened this issue Apr 7, 2022 · 0 comments

Comments

@jpn--
Copy link
Member

jpn-- commented Apr 7, 2022

One comment I will make: I feel as though the way the aggregation maps are currently defined isn't super user-friendly. For example, the major access trip mode in the MTC example it's currently defined as follows:

map:
        DRIVEALONEFREE: SOV
        DRIVEALONEPAY: SOV
        SHARED2FREE: HOV
        SHARED2PAY: HOV
        SHARED3FREE: HOV
        SHARED3PAY: HOV
        WALK_LOC: Walk to Transit
        WALK_LRF: Walk to Transit
        WALK_EXP: Walk to Transit
        WALK_HVY: Walk to Transit
        WALK_COM: Walk to Transit
        DRIVE_LOC: Drive to Transit
        DRIVE_LRF: Drive to Transit
        DRIVE_EXP: Drive to Transit
        DRIVE_HVY: Drive to Transit
        DRIVE_COM: Drive to Transit
        WALK: Non-Motorized
        BIKE: Non-Motorized
        TAXI: Ride Hail
        TNC_SINGLE: Ride Hail
        TNC_SHARED: Ride Hail

While this can be directly input into the pd.Series.map() function, the same information could be given by the following:

map:
    SOV:
        DRIVEALONEFREE
        DRIVEALONEPAY
    HOV:
        SHARED2FREE
        SHARED2PAY
        SHARED3FREE
        SHARED3PAY
    Walk to Transit:
        WALK_LOC
        WALK_LRF
        WALK_EXP
        WALK_HVY
        WALK_COM
    Drive to Transit:
        DRIVE_LOC
        DRIVE_LRF
        DRIVE_EXP
        DRIVE_HVY
        DRIVE_COM
    Non-Motorized:
        WALK
        BIKE
    Ride Hail:
        TAXI
        TNC_SINGLE
        TNC_SHARED

This is less repetitive and more readable. Something like this would then need to be added before line 289 of summarize.py and 290 would need to be changed to use map instead of agg['map'] (I can make the change if needed):

map = {}
for value in agg['map']:
    for key in agg['map'][value]:
        map[key] = value

Originally posted by @JoeJimFlood in #532 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant