arup-group / genet

Manipulate MATSim networks via a Python API.
MIT License
45 stars 9 forks source link

Stop attributes data summary is too specific #180

Closed KasiaKoz closed 1 year ago

KasiaKoz commented 1 year ago

schedule.summary() method fails here when not all stops have bikeAccessible

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-7-8c7164670021> in <module>
----> 1 n.schedule.summary()

~/genet/genet/schedule_elements.py in summary(self)
   3182             {'attributes': 'bikeAccessible'}).to_dict(orient='index')
   3183         for key in bike_attribs_dict.keys():
-> 3184             bike_accessible_keys.append(bike_attribs_dict[key]['attributes']['bikeAccessible'])
   3185         report['accessibility_tags']['Unique values for bikeAccessible tag'] = set(bike_accessible_keys)
   3186 

KeyError: 'bikeAccessible'

This method should be more general, showing that data there is, rather than assuming these keys are what the user is after.