2 ms·You can do that easily in numpy. ((x>0)-(x<0))*1 will give zeros and ones.by david_draco 7y agoYou can do that easily in numpy. ((x>0)-(x<0))*1 will give zeros and ones.