Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

numpy having no "isin" attribute

Tags:

python

numpy

I tried using the np.isin() function but everytime I do, it returns me the error:

AttributeError: 'module' object has no attribute 'isin'

here is exactly what I do

import numpy as np
a = np.arange(9).reshape((3,3))
test = np.arange(5)
print np.isin(a, test)

I havent found any information about this problem, I use the latest version of numpy and havent had any problem with other numpy module, why does it returns me this error?

like image 521
Tissuebox Avatar asked Jul 11 '17 21:07

Tissuebox


Video Answer


2 Answers

The isin function was added in NumPy 1.13:

New np.isin function, improves on in1d.

You're probably using an older version.

like image 68
MSeifert Avatar answered Sep 22 '22 00:09

MSeifert


Reading through the Notes section of the docs shows

New in version 1.13.0.

I suspect that if you do

print(np.__version__)

you will see something less than 1.13.0.

like image 35
Mad Physicist Avatar answered Sep 18 '22 00:09

Mad Physicist