def convert(table): num_rows = len(table) num_columns = len(table[0]) new_table = [] for row in range(1, num_rows): for column in range(1, num_columns): if table[row][column]!="": new_row = [] new_row.append(table[row][0]) new_row.append(table[0][column]) new_row.append(table[row][column]) new_table.append(new_row) return new_table table = [["", "Qual 1", "Qual 2", "Qual 3"], ["Andrew", "01.02.03", "27.06.08", "06.04.07"], ["Ben", "31.08.01", "", "05.07.04"], ["Carl", "", "18.04.03", "09.12.09"]] new_table = convert(table) print new_table