title: Rearranging axes in numpy?
body: <p>I have an ndarray such as</p>
  
  <pre><code>&gt;&gt;&gt; arr = np.random.rand(10, 20, 30, 40)
  &gt;&gt;&gt; arr.shape
  (10, 20, 30, 40)
  </code></pre>
  
  <p>whose axes I would like to swap around into some arbitrary order such as</p>
  
  <pre><code>&gt;&gt;&gt; rearranged_arr = np.swapaxes(np.swapaxes(arr, 1,3), 0,1)
  &gt;&gt;&gt; rearranged_arr.shape
  (40, 10, 30, 20)
  </code></pre>
  
  <p>Is there a function which achieves this without having to chain together a bunch of <code>np.swapaxes</code>?</p>