Created
January 23, 2018 14:13
-
-
Save zimmerrol/9540c60b0bf4ac9abef472bf44bdb48d to your computer and use it in GitHub Desktop.
lautze.py
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
lst = [(123, 456, 789), (123, 465, 789), (125, 456, 734)] | |
import numpy as np | |
#get unique IDs | |
fstuniq = np.unique([x[0] for x in lst]) | |
snduniq = np.unique([x[1] for x in lst]) | |
trduniq = np.unique([x[2] for x in lst]) | |
print(fstuniq) | |
print(snduniq) | |
print(trduniq) | |
#get unique second IDs where first ID equals value | |
value = 123 | |
specfstsnduniq = np.unique([x[1] for x in lst if x[0] == value]) | |
print(specfstsnduniq) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment