normalize from zero to one for row or table

def zero_to_one(table, option):
    """
    normalize from zero to one for row or table
    """
    if option == 'table':
        m = min(min(table))
        ma = max(max(table))
    t = []
    for row in table:
        t_row = []
        if option != 'table':
            m, ma = min(row), max(row)
        for i in row:
            if ma == m:
                t_row.append(0)
            else:
                t_row.append((i - m)/(ma - m))
        t.append(t_row)
    return t