TypeError: len () of unsized object how to solve

0
def invert_map(x):
    y = _np.empty_like(x)
    y[x] = _np.arange(len(x))
    return y

Result gives this in this function:

  

File "E: \ Anaconda3 \ lib \ site-packages \ arlpy \ comms.py", line 74, in invert_map      and [x] = _np.arange (len (x))

     

TypeError: len () of unsized object

What causes it? How to solve it?

    
asked by anonymous 18.07.2017 / 03:56

1 answer

0

Probably "x" is not a string.

Try converting it, like this:

len(str(TestV))
    
18.07.2017 / 13:57