Sort a string array by element lengths using NumPy
<p>I want to sort a string array using numpy by the length of the elements. </p>

<pre><code>&gt;&gt;&gt; arr = ["year","month","eye","i","stream","key","house"]
&gt;&gt;&gt; x = np.sort(arr, axis=-1, kind='mergesort')
&gt;&gt;&gt; print(x)
['eye' 'house' 'i' 'key' 'month' 'stream' 'year']
</code></pre>

<p>But it sorts them in alphanumeric order. How can I sort them using numpy by their length?</p>