title: Is there a Numpy equivalent to string `translate`?
body: <p>If I have a string</p>
  
  <pre><code>&gt;&gt;&gt; s = "abcdef"
  </code></pre>
  
  <p>I can replace more than one character with</p>
  
  <pre><code>&gt;&gt;&gt; s.translate(str.maketrans("abc", "xyz"))
  xyzdef
  </code></pre>
  
  <p>Is there a function that replicates this behavior in Numpy? i.e. some <code>func</code> such that</p>
  
  <pre><code>&gt;&gt;&gt; np.func(arr, mapping)
  mapped_array
  </code></pre>
  
  <p>This functionality can be implemented as</p>
  
  <pre><code>def func(arr, mapping):
      new_arr = arr.copy()
      for k, v in mapping.items():
          new_arr[new_arr == k] = v
      return new_arr
  </code></pre>
  
  <p>But this will be very slow for large arrays and/or large mappings.</p>