def savetable(ofile, bands, cols, data):
    """
    Save tabular data.

    Parameters
    ----------
    ofile : str
        Output file name.
    bands : list
        List of bands.
    cols : list
        List of column headings.
    data : list
        List of arrays containing statistics.

    Returns
    -------
    None.

    """
    fobj = open(ofile, 'a')
    htmp = cols[0]
    for i in cols[1:]:
        htmp += ',' + i
    for k, _ in enumerate(bands):
        fobj.write(bands[k] + '\n')
        fobj.write(htmp + '\n')
        for i, _ in enumerate(data[k]):
            rtmp = str(data[k][i][0])
            for j in range(1, len(data[k][0])):
                rtmp += ',' + str(data[k][i][j])
            fobj.write(rtmp + '\n')
        fobj.write('\n')
    fobj.close()
