def write_tabular(obj, filepath):
    """Write tabular object in HDF5 or pickle format

    Args:
        obj (array or DataFrame): tabular object to write
        filepath (path-like): path to write to; must end in '.h5' or '.pkl'
    """
    _, fn, ext = splitext2(filepath)
    if ext == '.h5':
        _write_tabular_h5(obj, filepath)
    elif ext == '.pkl':
        _write_tabular_pickle(obj, filepath)
    else:
        raise NotImplementedError
Write tabular object in HDF5 or pickle format

    Args:
        obj (array or DataFrame): tabular object to write
        filepath (path-like): path to write to; must end in '.h5' or '.pkl'