Say I have a list as given below:
l = [
['PER', 'O', 'O', 'GEO'],
['ORG', 'O', 'O', 'O'],
['O', 'O', 'O', 'GEO'],
['O', 'O', 'PER', 'O']
]
I want to encode the 2D list with LabelEncoder().
It should look something like:
l = [
[1, 0, 0, 2],
[3, 0, 0, 0],
[0, 0, 0, 2],
[0, 0, 1, 0]
]
Is it possible? If not, is there any workaround?
Thanks in advance!