[pypy-issue] [issue1726] numpy :numpy.unique reports NotImplementedError: sorting of non-numeric types 'void' is not implemented

lesshaste tracker at bugs.pypy.org
Mon Mar 31 18:32:07 CEST 2014


New submission from lesshaste <drraph at gmail.com>:

March 15 pypy daily snapshot.

#!/usr/bin/python

import numpy as np
def asvoid(arr):
    arr = np.ascontiguousarray(arr)
    return arr.view(np.dtype((np.void, arr.dtype.itemsize * arr.shape[-1])))


def nodistinctcols(M):
    MT = asvoid(M.T)
    uniqs = np.unique(MT)
    return len(uniqs)

n= 16

X = np.array([np.random.randint(2, size = n) for i in xrange(2**n)])
print "nodistinctcols(X.T)", nodistinctcols(X.T)

Output:
nodistinctcols(X.T)Traceback (most recent call last):
  File "app_main.py", line 72, in run_toplevel
  File "./test.py", line 17, in <module>
    print "nodistinctcols(X.T)", nodistinctcols(X.T)
  File "./test.py", line 11, in nodistinctcols
    uniqs = np.unique(MT)
  File
"/home/raph/python/pypy-2.3-alpha-20140316-linux_x86_64-portable/site-packages/numpy/lib/arraysetops.py",
line 196, in unique
    ar.sort()
NotImplementedError: sorting of non-numeric types 'void' is not implemented


Expected output:

nodistinctcols(X.T) 41465

----------
messages: 6674
nosy: lesshaste, pypy-issue
priority: bug
status: unread
title: numpy :numpy.unique reports NotImplementedError: sorting of non-numeric types 'void' is not implemented

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue1726>
________________________________________


More information about the pypy-issue mailing list