coal-mining accidents dataset

    Parameters
    ----------
    return_X_y : bool,
        if True, returns a model-ready tuple of data (X, y)
        otherwise, returns a Pandas DataFrame

    Returns
    -------
    model-ready tuple of data (X, y)
        OR
    Pandas DataFrame

    Notes
    -----
    The (X, y) tuple is a processed version of the otherwise raw DataFrame.

    A histogram of 150 bins has been computed describing the number accidents per year.

    X contains the midpoints of histogram bins.
    y contains the count in each histogram bin.

    Source:
    https://vincentarelbundock.github.io/Rdatasets/doc/boot/coal.html

def coal(return_X_y=True):
    """coal-mining accidents dataset

    Parameters
    ----------
    return_X_y : bool,
        if True, returns a model-ready tuple of data (X, y)
        otherwise, returns a Pandas DataFrame

    Returns
    -------
    model-ready tuple of data (X, y)
        OR
    Pandas DataFrame

    Notes
    -----
    The (X, y) tuple is a processed version of the otherwise raw DataFrame.

    A histogram of 150 bins has been computed describing the number accidents per year.

    X contains the midpoints of histogram bins.
    y contains the count in each histogram bin.

    Source:
    https://vincentarelbundock.github.io/Rdatasets/doc/boot/coal.html
    """
    # y is counts
    # recommend PoissonGAM
    coal = pd.read_csv(PATH + '/coal.csv', index_col=0)
    if return_X_y:
        y, x = np.histogram(coal.values, bins=150)
        X = x[:-1] + np.diff(x)/2 # get midpoints of bins
        return _clean_X_y(X, y)
    return coal