I want to get the c array as result, but I don’t know how:
import numpy as np
a = xrange(10)
b = np.array([3,2,1,9])
c is made of elements of a that are not in b:
c = np.array([0,4,5,6,7,8])
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Perhaps a more straightforward solution is the following:
Which results in:
You can find all of the set-like operations for numpy arrays in the documentation:
http://docs.scipy.org/doc/numpy/reference/routines.set.html