<jupyter_start><jupyter_text>Read GTFS<jupyter_code>feed = importer.GtfsImporter(path=data + r'bilbao.zip', dist_units='m')
feed = feed.clean()
feed.describe()
feed.validate()
feed.map_stops(feed.stops.stop_id)
feed = feed.create_shapes()
feed.map_trips(
    feed.trips.groupby('route_id').first().trip_id.head(50)
)<jupyter_output><empty_output><jupyter_text>Frequency conversion currently work only for one specific service and date, and on one given time period.  It computes the average headway over this time period.  Restrict to one date and merge services<jupyter_code>feed = feed.restrict(dates=['20191210'])
feed.group_services()
feed.describe()<jupyter_output><empty_output><jupyter_text>Build simplified patterns by clustering stops<jupyter_code>feed.build_stop_clusters(distance_threshold=300)
print('N stops:', len(feed.stops))
print('N clusters:', len(feed.stops.cluster_id.unique()))
feed.build_patterns(on='cluster_id')
print('N trips:', len(feed.trips))
print('N patterns:', len(feed.trips.pattern_id.unique()))
print('N routes:', len(feed.trips.route_id.unique()))
feed.describe()<jupyter_output><empty_output><jupyter_text>Convert to frequencies<jupyter_code>time_range = ['08:00:00', '10:00:00']  # time format must be HH:MM:SS
feed_f = feed.convert_to_frequencies(time_range=time_range)
feed_f.describe()<jupyter_output><empty_output><jupyter_text>Build nodes and links<jupyter_code>feed_f.build_links_and_nodes()
feed_f.nodes.head(1).T
feed_f.links.head(1).T<jupyter_output><empty_output><jupyter_text>All in oneWhile we recommand to build the nodes and links gradually by exploring the GTFS data first, it is also possible to do it in one line.<jupyter_code>feed = importer.GtfsImporter(path=data + r'bilbao.zip', dist_units='m')
feed.describe()
imp = feed.build(
    date='20191210',
    time_range=['08:00:00', '10:00:00'],
    cluster_distance_threshold=300 # by default: None and no clustering
)
imp.describe()
imp.links.head()
imp.nodes.head()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1374312843578211, 'fraction_numerical': 0.02498750624687656, 'mean_word_length': 8.1, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '7805', 'license': 'CECILL-B', 'n_tokens_mistral': 759, 'n_tokens_neox': 715, 'n_words': 135, 'path': 'examples-ipynb/gtfs_reader/.ipynb_checkpoints/5-quetzal-importer-checkpoint.ipynb', 'repo_name': 'systragroup/quetzal', 'size': '2001'}