<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<div name="messageBodySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;">selector = target != 2
<div>data, target = data[selector], target[selector]</div>
</div>
<div name="messageReplySection" style="font-size: 14px; font-family: -apple-system, BlinkMacSystemFont, sans-serif;"><br />
On 4 Dec 2017, 8:38 AM +1100, Peng Yu <pengyu.ut@gmail.com>, wrote:<br />
<blockquote type="cite" style="margin: 5px 5px; padding-left: 10px; border-left: thin solid #1abc9c;">Hi, I'd like to select the rows of 'data' for which the corresponding<br />
elements in 'target' is not 2. Could anybody let know what is the best<br />
way (with the least code) to do conditional subsetting like this with<br />
numpy objects? Thanks.<br />
<br />
from sklearn import datasets<br />
data, target = datasets.load_iris()<br />
<br />
--<br />
Regards,<br />
Peng<br />
_______________________________________________<br />
NumPy-Discussion mailing list<br />
NumPy-Discussion@python.org<br />
https://mail.python.org/mailman/listinfo/numpy-discussion<br /></blockquote>
<div></div>
</div>
</body>
</html>