kuanb / peartree

peartree: A library for converting transit data into a directed graph for sketch network analysis.
MIT License
201 stars 23 forks source link

Refactor average cost reformatting for wait times #96

Closed kuanb closed 6 years ago

kuanb commented 6 years ago

Fixes https://github.com/kuanb/peartree/issues/95

Better/more clear handlings of Series conversion to DataFrame. Also, check for when no valid wait times are parsed. If this condition occurs, then raise a custom exception.

UPDATE: Do not raise exception. The issue is when there is just, say, one line with only on stop at each stop an no valid wait time for the given time period. Again, this is the case in the example GTFS. So, the average wait times dataframe is empty. This is OK! We just need to accept that this part is empty and proceed to fallback wait time assignment step.

Example GTFS that would trigger this: f-9rc-highdesertpointorus.zip

codecov[bot] commented 6 years ago

Codecov Report

Merging #96 into master will increase coverage by 0.08%. The diff coverage is 93.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #96      +/-   ##
==========================================
+ Coverage   91.71%   91.79%   +0.08%     
==========================================
  Files          12       12              
  Lines         881      890       +9     
==========================================
+ Hits          808      817       +9     
  Misses         73       73
Impacted Files Coverage Δ
peartree/summarizer.py 92.35% <93.33%> (+0.42%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b1e8677...5bbb9ba. Read the comment docs.

kuanb commented 6 years ago

Note, update added to original PR notes:

UPDATE: Do not raise exception. The issue is when there is just, say, one line with only on stop at each stop an no valid wait time for the given time period. Again, this is the case in the example GTFS. So, the average wait times dataframe is empty. This is OK! We just need to accept that this part is empty and proceed to fallback wait time assignment step.