def build_routes(pfeed):
    """
    Given a ProtoFeed, return a DataFrame representing ``routes.txt``.
    """
    f = (
        pfeed.frequencies.filter(
            ["route_short_name", "route_long_name", "route_type", "shape_id"]
        )
        .drop_duplicates()
        .copy()
    )

    # Create route IDs
    f["route_id"] = "r" + f["route_short_name"].map(str)

    del f["shape_id"]

    return f