{"version":"1.0","type":"rich","title":"A Python function to calculate the headways of transit vehicles arranged sequentially for a week, accounting for time over midnight over one or more days. Uses NumPy.","description":"This example demonstrates a NumPy-based Python function that converts a week’s timetable of transit vehicle arrival times into headways—the seconds until the next vehicle arrives—while correctly handling gaps across midnight and entire days without service. The function `headway_array` takes a 2D array where rows represent sequential trips and columns represent days of the week, with `None` placeholders for trips that do not run on certain days. It returns an array of the same shape with headway values, using a custom formula to account for elapsed midnights and clamping results to a maximum of `maxseconds` times `daysinweek`. The code includes docstring examples showing the transformation on sample data.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-2d3acc4558350318155c?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}