| --- |
| license: cc-by-4.0 |
| task_categories: |
| - time-series-forecasting |
| - tabular-regression |
| tags: |
| - transportation |
| - trains |
| - germany |
| - deutsche-bahn |
| - delays |
| - timetables |
| size_categories: |
| - 100M<n<1B |
| pretty_name: Deutsche Bahn Data |
| --- |
| |
| # Deutsche Bahn Train Data |
|
|
| This dataset contains public historical data from Deutsche Bahn, the largest German train company. It includes train schedules, delays, and cancellations from stations across Germany. |
|
|
| For more info visit the project page at GitHub: https://github.com/piebro/deutsche-bahn-data |
|
|
| ## Dataset Structure |
|
|
| ### Monthly Processed Data |
|
|
| The monthly processed data is located in `monthly_processed_data/` and contains files named `data-YYYY-MM.parquet`. |
|
|
| **Schema:** |
|
|
| | Column | Type | Description | |
| |--------|------|-------------| |
| | `station_name` | string | Name of the station | |
| | `xml_station_name` | string | Station name from the XML response | |
| | `eva` | string | EVA station number (unique identifier) | |
| | `train_name` | string | Name of the train (e.g., "ICE 123", "RE 5") | |
| | `final_destination_station` | string | Final destination of the train | |
| | `delay_in_min` | integer | Delay in minutes | |
| | `time` | timestamp | Actual arrival or departure time | |
| | `is_canceled` | boolean | Whether the train stop was canceled | |
| | `train_type` | string | Type of train (e.g., "ICE", "IC", "RE") | |
| | `train_line_ride_id` | string | Unique identifier for the train ride | |
| | `train_line_station_num` | integer | Station number in the train's route | |
| | `arrival_planned_time` | timestamp | Planned arrival time | |
| | `arrival_change_time` | timestamp | Actual/changed arrival time | |
| | `departure_planned_time` | timestamp | Planned departure time | |
| | `departure_change_time` | timestamp | Actual/changed departure time | |
| | `id` | string | Unique identifier for the train stop | |
|
|
| ### Raw Data |
|
|
| The raw data is located in `raw_data/` and is partitioned by `year={year}/month={month}/day={day}/`. Each partition contains multiple parquet files with hourly data. |
|
|
| **Schema:** |
|
|
| | Column | Type | Description | |
| |--------|------|-------------| |
| | `timestamp` | timestamp | When the API request was made | |
| | `url` | string | The API endpoint URL that was queried | |
| | `api_name` | string | Name of the API (e.g., "timetables/v1/plan", "timetables/v1/fchg") | |
| | `query_params` | string | JSON string of query parameters used | |
| | `response_data` | string | Raw XML or JSON response from the API | |
| | `status_code` | string | HTTP status code of the response | |
| | `error` | string | Error message if the request failed | |
| | `duration_ms` | float | Request duration in milliseconds | |
| | `year` | integer | Year of the request (partition key) | |
| | `month` | integer | Month of the request (partition key) | |
| | `day` | integer | Day of the request (partition key) | |
|
|
| ## License |
|
|
| The dataset is licensed under [Attribution 4.0 International (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/) by Deutsche Bahn. |
|
|
| ## Acknowledgments |
|
|
| Data sourced from Deutsche Bahn's public APIs. Special thanks to Deutsche Bahn for providing open access to this data. |