As a toy example let's say that I have:
import numpy as np
np.array([['dog','sheep','sheep','dog','cat'],
['dog','dog','sheep','cat','cat']])
dict = {'dog':5,'cat':1,'sheep':3}
I want to find an efficient way to construct the desired array where I replaced the elements according to the dictionary.
(The real dictionary is the periodic table and the real array has thousands of elements)