import numpy
dataset2D = [[6, 4], [0, 0, 0, 1], [1, 0, 2, 0], [2, 2, 0, 1], [1, 1, 1, 0],
    [0, 0, 1, 1], [1, 0, 2, 1]]
dataset2D_size = dataset2D[0]
dataset2D = numpy.array(dataset2D)
partition2D = [['A', '1', '2', '4'], ['B', '3', '5'], ['C', '6']]
for partition in partition2D:
    label = partition[0]
row_indices = [int(i) for i in partition[1:]]
rows = dataset2D[row_indices]
for column in zip(*rows):
    print(column, end=' ')
print()
Iterate over two nested 2D lists where list2 has list1's row numbers