Skip to content

Replace GTFS operations with DuckDB and fix station sequence bugs#134

Merged
yu-ta-sato merged 3 commits intoc2g-dev:mainfrom
yu-ta-sato:use_duckdb
Mar 14, 2026
Merged

Replace GTFS operations with DuckDB and fix station sequence bugs#134
yu-ta-sato merged 3 commits intoc2g-dev:mainfrom
yu-ta-sato:use_duckdb

Conversation

@yu-ta-sato
Copy link
Copy Markdown
Collaborator

Description

This PR refactors GTFS transportation graph processing in transportation.py, by replacing pandas operations with duckdb.

It also fixed an issue of not handling station sequences as integers due to the alphabetical order of strings (e.g., "1", "10", "11", ... , "2", "3" -> 1, 2, ... 9, 10).

Other changes:

  • Allow directed graph as nx.DiGraph() if directed=True.
  • Use frequencies.txt for calculating the frequencies if given and use_frequencies=True.

This is a major change where load_gtfs produces duckdb.DuckDBPyConnection instead of a dictionary of Pandas Dataframe, as well as the inputs for travel_summary_graph and get_od_pair.

Related Issues

NA

Checklist

  • I have read the Contributing Guide.
  • I have updated the documentation, if necessary.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • Pre-commit checks passed locally.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@yu-ta-sato yu-ta-sato merged commit 70e17d2 into c2g-dev:main Mar 14, 2026
7 checks passed
@yu-ta-sato yu-ta-sato deleted the use_duckdb branch March 14, 2026 23:10
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

Successfully merging this pull request may close these issues.

1 participant