NB: Insert \newcolumntype{.}[1]{D{.}{.}{#1}} in header.

def tex_table(a1, a2, mup):
    """ NB: Insert \newcolumntype{.}[1]{D{.}{.}{#1}} in header.
    """
    assert a1.shape == a2.shape
    m, n = a1.shape
    s = ""
    s += "\\begin{table}\n"
    s += "\\begin{center}\n"
    cols = "c.{2.2}" + ("|.{2.1}.{3.1}" * (n)) + "|"
    s += "\\begin{tabular}{%s}\n" % cols
    s += "\cline{3-10}\n"
    s += " & &\multicolumn{8}{c|}{$G_1$} \\\\\n"
    s += "\cline{3-10}\n"
    s += " &"
    for i in range(n):
#        align = "c" if i == 0 else "c|"
        s += " &\multicolumn{2}{c|}{%s\\%%}" % mup[i]
    s += " \\\\\n"
    s += " &"
    for i in range(n):
        s += " &r_1 &r_2"
    s += " \\\\\n"
    s += "\hline\n"
    s += "\multicolumn{1}{|c|}{\multirow{4}{*}{$G_2$}}"
    for i in range(m):
        if i != 0:
            s += "\multicolumn{1}{|c|}{}"
        s += " &%.1f\\%%" % mup[i]
        for j in range(n):
            s += " &%.1f" % abs(a1[i, j])
            s += " &%.1f" % abs(a2[i, j])
        s += " \\\\\n"
    s += "\hline\n"
    s += "\end{tabular}\n"
    s += "\caption{Agent reward for Nash equilibrium analysis}\n"
    s += "\label{tbl:nash}\n"
    s += "\end{center}\n"
    s += "\end{table}"

    return s