Question: python code to perform the following tasks: Take two numpy arrays (e.g. a = numpy.array([1,1,2,3,5,8,13,21,34,55,89]) and b = numpy.array([1,2,3,4,5,6,7,8,9,10,11,12,13]). Write a program that returns a

python code to perform the following tasks:

Take two numpy arrays (e.g. a = numpy.array([1,1,2,3,5,8,13,21,34,55,89]) and b = numpy.array([1,2,3,4,5,6,7,8,9,10,11,12,13]). Write a program that returns a numpy array that contains only the elements that are common between the lists (without duplicates). Make sure your program works on two lists of different sizes and test the program by randomly generating two integer lists of size 20 and 25, respectively containing numbers from 0 to 99. Test the performance of this function using the %timeit functionality in a notebook and write the observed time below (hint: numpy.unique() function removes duplicates in numpy arrays. also consider using a boolean mask)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!