Created
July 9, 2018 10:39
-
-
Save utahka/d5f93ca0b912f0e433e789c59929b33e to your computer and use it in GitHub Desktop.
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 as np | |
def intersect2d(x, y): | |
_, ncols = x.shape | |
dtype = { | |
"names": [f"f{i}" for i in range(ncols)], | |
"formats": ncols * [predict.dtype], | |
} | |
intersect = np.intersect1d(x.view(dtype), y.view(dtype)) | |
intersect = intersect.view(x.dtype).reshape(-1, ncols) | |
return intersect |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Numpy intersect2d