CoolFace
Datasetpublic

piebro/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… See the full description on the dataset page: https://huggingface.co/datasets/piebro/deutsche-bahn-data.

sourceHugging Facecc-by-4.0updated 2h agoView on Hugging Face
15likes9.4kdownloads
Dataset Card

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:

ColumnTypeDescription
station_namestringName of the station
xml_station_namestringStation name from the XML response
evastringEVA station number (unique identifier)
train_numberstringTrain number / Zugnummer, the raw tl.n value identifying a specific train run (e.g., "123", "12603"). Combine with train_type for a label like "ICE 123"
line_numberstringLine number / Liniennummer, the raw ar.l/dp.l value identifying the route, non-unique (e.g., "RB23", "14"); null for long-distance trains (ICE/IC/EC) where the API provides no line
final_destination_stationstringFinal destination of the train
delay_in_minintegerDelay in minutes
timetimestampActual arrival or departure time
arrival_is_canceledbooleanWhether the arrival at the train stop was canceled
departure_is_canceledbooleanWhether the departure from the train stop was canceled
train_typestringType of train (e.g., "ICE", "IC", "RE")
train_line_ride_idstringUnique identifier for the train ride
train_line_station_numintegerStation number in the train's route
arrival_planned_timetimestampPlanned arrival time
arrival_change_timetimestampActual/changed arrival time
departure_planned_timetimestampPlanned departure time
departure_change_timetimestampActual/changed departure time
idstringUnique 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:

ColumnTypeDescription
timestamptimestampWhen the API request was made
urlstringThe API endpoint URL that was queried
api_namestringName of the API (e.g., "timetables/v1/plan", "timetables/v1/fchg")
query_paramsstringJSON string of query parameters used
response_datastringRaw XML or JSON response from the API
status_codestringHTTP status code of the response
errorstringError message if the request failed
duration_msfloatRequest duration in milliseconds
yearintegerYear of the request (partition key)
monthintegerMonth of the request (partition key)
dayintegerDay of the request (partition key)

License

The dataset is licensed under Attribution 4.0 International (CC 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.