<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><br></div><div>Hello,</div><div><br></div><div>I've found a strange behavior or I'm missing something obvious (or np.unique is not supposed to work with structured arrays).</div><div><br></div><div>I'm trying to extract unique values from a simple structured array but it does not seem to work as expected.</div><div>Here is a minimal script showing the problem:</div><div><br></div><div><font face="Menlo">import numpy as np<br><br>V = np.zeros(4, dtype=[("v", np.float32, 3)])<br>V["v"] = [ [0.5,    0.0,   1.0],<br>           [0.5, -1.e-16,  1.0], # [0.5, +1.e-16,  1.0] works<br>           [0.5,    0.0,  -1.0],<br>           [0.5, -1.e-16, -1.0]] # [0.5, +1.e-16, -1.0]] works<br>V_ = np.zeros_like(V)<br>V_["v"][:,0] = V["v"][:,0].round(decimals=3)<br>V_["v"][:,1] = V["v"][:,1].round(decimals=3)<br>V_["v"][:,2] = V["v"][:,2].round(decimals=3)<br><br>print np.unique(V_)<br>[([0.5, 0.0, 1.0],) ([0.5, 0.0, -1.0],) ([0.5, -0.0, 1.0],) ([0.5, -0.0, -1.0],)]</font></div><div><br></div><div><br></div><div>While I would have expected:</div><div><div><font face="Menlo"><br></font></div><div><font face="Menlo">[([0.5, 0.0, 1.0],) ([0.5, 0.0, -1.0],)]</font></div></div><div><font face="Menlo"><br></font></div><div><font face="Menlo"><br></font></div><div><div>Can anyone confirm ?</div></div><div><br></div><div><br></div><div>Nicolas</div></body></html>