def drop_series_w_gaps(df, series_id, date_col, target, max_gap=1, output_dropped_series=False):
    """
    Removes series with missing rows
    
    df: pandas df
    series_id: str
        Column name with series identifier
    date_col: str
        Column name of datetime column
    target: str
        Column name of target column
    max_gap: int
        number of allowed missing timestep
    output_dropped_series: bool (optional)
        allows return of pandas df of series that do not satisfy max_gap criteria
    
    Returns:
    --------
    pandas df(s)
    """
    
    if not isinstance(max_gap, int):
        raise TypeError('max gap must be an int')

    df.sort_values(by=[date_col, series_id], ascending=True, inplace=True)
    series_max_gap = df.groupby([series_id]).apply(lambda x: x[date_col].diff().max())
    median_timestep = df.groupby([series_id])[date_col].diff().median()
    series_to_keep = series_max_gap[(series_max_gap / median_timestep) <= max_gap].index.values

    sampled_df = df.loc[df[series_id].isin(series_to_keep), :]
    dropped_df = df.loc[~df[series_id].isin(series_to_keep), :]

    if output_dropped_series:
        return sampled_df, dropped_df
    else:
        return sampled_df