def shorten_paths_to_stops(x):
    """Shorten the train TIPLOC path to only include locations where train stops
    
    Input parameters:
    -----------------
    x: Pandas dataframe object that should contain a column named path

    Result:
    -------
    path - List of TILOC IDs where train stops
    """
    path = []
    for p in range(len(x.path)):
        if x.stops[p] == 'S':
            path.append(x.path[p])

    return path