Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- import numpy as np
- from operator import itemgetter
- from itertools import groupby
- def removeIncomplete(id):
- idx=[(i,j) for (i,j) in enumerate(id)]
- str_lst=[str(i) for i in id]
- a=[list(g) for k,g in groupby(sorted(str_lst),key=itemgetter(0))]
- b=[float(x) for _list in a if len(_list)==3 for x in _list ]
- idComplete = [j for i,j in idx if j in b]
- idComplete = np.around(idComplete, decimals=1)
- return idComplete
- print(removeIncomplete(np.array([1.3, 2.2, 2.3, 4.2, 5.1, 3.2, 5.3, 3.3, 2.1, 1.1, 5.2, 3.1])))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement