def serialize_df(df, path, index=True):
    """Serializes a pandas DataFrame to a feather file on disk.

    If the data frame has a non-default index, that is added back as a column before writing out.
    
    Parameters
    ----------
    df : pandas.DataFrame
    path : str
        path to feather file to write
    index : bool
        if False, will drop the index
    """
    df = df.copy()
    if df.index.name or not index:
        df.reset_index(inplace=True, drop=not index or df.index.name in df.
            columns)
    df.to_feather(path)
