Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. some_dict=defaultdict(dict)
  2. for x, y, z in zip(val_df['timestamp'].values, val_df['res'], val_df['building_id']):
  3.     some_dict[z][x] = y
  4.  
  5. new_col_plus = [some_dict[row['building_id']].get(row['timestamp']+np.timedelta(1, 'W'), np.nan) for (ind, row) in val_df.iterrows()]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement