Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ll = []
- for i in tqdm(a.itertuples(index=False), total = len(a)):
- d1 = str(i.d1cid)
- d2 = str(i.d2cid)
- temp = i._asdict() # tranform named tuple into dict
- temp.update({k: int(v) for k,v in enumerate(np.mean([names[d1],names[d2]], axis=0))}) # merge two dict, first - created from named tuple, second - from dict comprehension of enumerating over an array
- ll.append(temp)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement