def split_df(df, index_range, columns, iloc=False):
    'Split a data frame by selecting from columns a particular range.\n\n    Args:\n        df (:class:`pd.DataFrame`): Data frame to split.\n        index_range (tuple): Tuple containing lower and upper limit of the\n            range to split the index by. If `index_range = (a, b)`, then\n            `[a, b)` is taken.\n        columns (list[object]): Columns to select.\n        iloc (bool, optional): The index range is the integer location instead\n            of the index value. Defaults to `False`.\n\n    Returns:\n        tuple[:class:`pd.DataFrame`]: Selected rows from selected columns\n            and the remainder.\n    '
    if iloc:
        inds = np.arange(df.shape[0])
        rows = ((inds >= index_range[0]) & (inds < index_range[1]))
    else:
        rows = ((df.index >= index_range[0]) & (df.index < index_range[1]))
    selected = pd.DataFrame([df[name][rows] for name in columns]).T
    remainder = pd.DataFrame(([df[name][(~ rows)] for name in columns] + [df[name] for name in (set(df.columns) - set(columns))])).T
    selected_inds = [i for (i, c) in enumerate(df.columns) if (c in columns)]
    selected = selected.reindex(df.columns[np.array(selected_inds)], axis=1)
    remainder = remainder.reindex(df.columns, axis=1)
    return (selected, remainder)
Split a data frame by selecting from columns a particular range.

Args:
    df (:class:`pd.DataFrame`): Data frame to split.
    index_range (tuple): Tuple containing lower and upper limit of the
        range to split the index by. If `index_range = (a, b)`, then
        `[a, b)` is taken.
    columns (list[object]): Columns to select.
    iloc (bool, optional): The index range is the integer location instead
        of the index value. Defaults to `False`.

Returns:
    tuple[:class:`pd.DataFrame`]: Selected rows from selected columns
        and the remainder.
def split_df(df, index_range, columns, iloc=False):
    'Split a data frame by selecting from columns a particular range.\n\n    Args:\n        df (:class:`pd.DataFrame`): Data frame to split.\n        index_range (tuple): Tuple containing lower and upper limit of the\n            range to split the index by. If `index_range = (a, b)`, then\n            `[a, b)` is taken.\n        columns (list[object]): Columns to select.\n        iloc (bool, optional): The index range is the integer location instead\n            of the index value. Defaults to `False`.\n\n    Returns:\n        tuple[:class:`pd.DataFrame`]: Selected rows from selected columns\n            and the remainder.\n    '
    if iloc:
        inds = np.arange(df.shape[0])
        rows = ((inds >= index_range[0]) & (inds < index_range[1]))
    else:
        rows = ((df.index >= index_range[0]) & (df.index < index_range[1]))
    selected = pd.DataFrame([df[name][rows] for name in columns]).T
    remainder = pd.DataFrame(([df[name][(~ rows)] for name in columns] + [df[name] for name in (set(df.columns) - set(columns))])).T
    selected_inds = [i for (i, c) in enumerate(df.columns) if (c in columns)]
    selected = selected.reindex(df.columns[np.array(selected_inds)], axis=1)
    remainder = remainder.reindex(df.columns, axis=1)
    return (selected, remainder)