I have an array
ar= [2, 3, 45 , 5556, 6, 'empty', 4]
I'd like to normalize this array in order to plot it later.
0:2
1:3
2:45
3: 5556
4: 6
5: 0 # not "empty" anymore
6: 4
newAr = {if (ar[i] != 'empty') ar[i] : i for i in range(len(ar))
else: ar[i] = 0 }
I tried this way, How can I normilize this array with condition of converting every 'empty' element with zero.
UPDATE The main goal is to normalize this array. Axe X: for index, Axe Y for the value.
what if we have duplicates, how can we make sure that we have the right references.
ar= [2, 3, 45, 4 , 5556, 6, 'empty', 4]
0:2
1:3
2:45
3: 5556
4: 6
5: 0 # not "empty" anymore
6: 4