I have some data, for example:
input=[['1', '7', 'U1'], ['1.5', '8', 'U1'], ['2', '5.5', 'U1'], ['2', '9', 'U1'], ['2.5', '6.5', 'U1'], ['2.5', '8', 'U1'], ['2.5', '10', 'U2'], ['3', '4.5', 'U2'], ['3', '9', 'U2'], ['3.5', '5.5', 'U2']]
How can I get numbers of how many U1 and U2 data is in all my data? This U1 and U2 is always on last place of every row, but has various name(so it must first read name….)!!!. I want to get for this example:
U1: 6
U2: 4
I modified the index from
2to-1to reflect your requirement of ‘last element on every row’ in case each row has a different number of elements.