Created
May 2, 2012 14:43
-
-
Save albarrentine/2577070 to your computer and use it in GitHub Desktop.
Numpy set APIs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
a = numpy.arange(10) | |
b = numpy.arange(5, 15) | |
numpy.setdiff1d(a,b) # array([0, 1, 2, 3, 4]) | |
numpy.union1d(a,b) # array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) | |
numpy.intersect1d(a,b) # array([5, 6, 7, 8, 9]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment