I am trying to make key-value pair from 2 ndarray in my data. To do so, I tried to loop through each list of ndarray try to put them together, but it is not quite working for me. Can anyone suggest possible way of doing this? Any idea?
data and my attempt
here is first list of ndarray that I need to make dictionary from it:
['267']
['354' '783']
['21488']
['6063A']
['86R']
['969']
['332']
['630']
['788']
['8']
['27']
['278']
['262' '86K']
here is second list of ndarray:
['JBS']
['Cargill' 'Harris Ranch']
['One World']
['Central Valley']
['Cargill']
['JBS']
['FPL']
['CS Beef']
['Aurora Pack']
['National Beef']
['Creekstone']
['Tyson']
['National Beef' 'Cargill']
my attempt:
here is my attempt:
import numpy as np
for (i,j), value in np.ndenumerate(first_ndarray):
for(m,n), value_2 in np.ndenumerate(first_ndarray):
dict= to_dict(value, value_2)
but this is not working for me, looks the way of iterating ndarray might be right but making key-value pair from it is not happen. Can anyone point me out how to make this happen? Any thoughts?
desired output
here is the output that I want:
['JBS': '267']
['Cargill': '354' , 'Harris Ranch': '783']
['One World': 21488']
['Central Valley':'6063A']
['Cargill':'86R']
['JBS':'969']
['FPL':'332']
['CS Beef':'630']
['Aurora Pack':'788']
['National Beef':'8']
['Creekstone':'27']
['Tyson':'278']
['National Beef':'262', 'Cargill':'86K']
how can I get my desired output? Any idea? thanks!