gabkdlly

Zip me some features by id

Dec 4th, 2020 (edited)
664
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ids = list(set([ row[0] for row in data))
  2. data = [[id,[ data[row][1] for row in data if row[0] == id ]] for id in ids]
  3. data = [[pair[0],list(zip(pair[1][:-1],pair[1][1:]))] for pair in data]
  4.  
RAW Paste Data