<p dir="auto">In Python 2, the following code used to work, but no longer in Python 3:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [6]: x = np.array([1.1, 'a'], dtype=np.object)

In [7]: np.unique(x)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
&lt;ipython-input-7-9a478241c930&gt; in &lt;module&gt;()
----&gt; 1 np.unique(x)

/Users/tom/Library/Python/3.4/lib/python/site-packages/numpy/lib/arraysetops.py in unique(ar, return_index, return_inverse, return_counts)
    193         aux = ar[perm]
    194     else:
--&gt; 195         ar.sort()
    196         aux = ar
    197     flag = np.concatenate(([True], aux[1:] != aux[:-1]))

TypeError: unorderable types: float() &gt; str()"><pre class="notranslate"><code class="notranslate">In [6]: x = np.array([1.1, 'a'], dtype=np.object)

In [7]: np.unique(x)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
&lt;ipython-input-7-9a478241c930&gt; in &lt;module&gt;()
----&gt; 1 np.unique(x)

/Users/tom/Library/Python/3.4/lib/python/site-packages/numpy/lib/arraysetops.py in unique(ar, return_index, return_inverse, return_counts)
    193         aux = ar[perm]
    194     else:
--&gt; 195         ar.sort()
    196         aux = ar
    197     flag = np.concatenate(([True], aux[1:] != aux[:-1]))

TypeError: unorderable types: float() &gt; str()
</code></pre></div>
<p dir="auto">Is this intended behavior, and if so, are there any suggested alternatives in this situation?</p>
<h3 dir="auto">Describe the issue:</h3>
<p dir="auto">Just a tracking issue here, sorry if this is a duplicate (I tried searching and didn't notice anything).</p>
<h3 dir="auto">Reproduce the code example:</h3>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# N/A"><pre class="notranslate"><span class="pl-c"># N/A</span></pre></div>
<h3 dir="auto">Error message:</h3>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="# N/A"><pre class="notranslate"><span class="pl-c"><span class="pl-c">#</span> N/A</span></pre></div>
<h3 dir="auto">NumPy/Python version information:</h3>
<p dir="auto">1.21.2</p>