Oct-01-2019, 06:18 PM
I have these two arrays:
Thanks
arr1 = ['sub1', 'sub1', 'sub2', 'sub1', 'sub1', 'sub2']
arr2 = [1.9 , 2.2 , 9.1 , 7.3 , 4.0 , 5.1 ]When I do dict(zip(arr1, arr2,)) I get
sub1 : 4, sub2 : 5.1whereas I was expecting something like
sub1 : (1.9, 2.2, 7.3, 4.0), sub2 : (9.1, 5.1)(ie the name and then the numbers in a list, tuple or between {}). Does anyone know if zip() can do this or how I can do it another way?
Thanks