def compute_stop_activity(feed: "Feed", dates: List[str]) -> DataFrame:
    """
    Mark stops as active or inactive on the given dates.
    A stop is *active* on a given date if some trips that starts on the
    date visits the stop (possibly after midnight).

    Parameters
    ----------
    feed : Feed
    dates : string or list
        A YYYYMMDD date string or list thereof indicating the date(s)
        for which to compute activity

    Returns
    -------
    DataFrame
        Columns are

        - stop_id
        - ``dates[0]``: 1 if the stop has at least one trip visiting it
          on ``dates[0]``; 0 otherwise
        - ``dates[1]``: 1 if the stop has at least one trip visiting it
          on ``dates[1]``; 0 otherwise
        - etc.
        - ``dates[-1]``: 1 if the stop has at least one trip visiting it
          on ``dates[-1]``; 0 otherwise

    Notes
    -----
    - If all dates lie outside the Feed period, then return an empty
      DataFrame
    - Assume the following feed attributes are not ``None``:

        * ``feed.stop_times``
        * Those used in :func:`.trips.compute_trip_activity`

    """
    dates = feed.restrict_dates(dates)
    if not dates:
        return pd.DataFrame()

    trip_activity = feed.compute_trip_activity(dates)
    g = pd.merge(trip_activity, feed.stop_times).groupby("stop_id")
    # Pandas won't allow me to simply return g[dates].max().reset_index().
    # I get ``TypeError: unorderable types: datetime.date() < str()``.
    # So here's a workaround.
    for (i, date) in enumerate(dates):
        if i == 0:
            f = g[date].max().reset_index()
        else:
            f = f.merge(g[date].max().reset_index())
    return f
Mark stops as active or inactive on the given dates.
    A stop is *active* on a given date if some trips that starts on the
    date visits the stop (possibly after midnight).

    Parameters
    ----------
    feed : Feed
    dates : string or list
        A YYYYMMDD date string or list thereof indicating the date(s)
        for which to compute activity

    Returns
    -------
    DataFrame
        Columns are

        - stop_id
        - ``dates[0]``: 1 if the stop has at least one trip visiting it
          on ``dates[0]``; 0 otherwise
        - ``dates[1]``: 1 if the stop has at least one trip visiting it
          on ``dates[1]``; 0 otherwise
        - etc.
        - ``dates[-1]``: 1 if the stop has at least one trip visiting it
          on ``dates[-1]``; 0 otherwise

    Notes
    -----
    - If all dates lie outside the Feed period, then return an empty
      DataFrame
    - Assume the following feed attributes are not ``None``:

        * ``feed.stop_times``
        * Those used in :func:`.trips.compute_trip_activity`