Skip to content

Instantly share code, notes, and snippets.

@cigrainger
Created February 28, 2016 14:51
Show Gist options
  • Save cigrainger/d47041d6ec244d5a4170 to your computer and use it in GitHub Desktop.
Save cigrainger/d47041d6ec244d5a4170 to your computer and use it in GitHub Desktop.
correct_precip = []
for t in df.DateTime:
if t.hour not in [0,6,12,18]:
precip_1 = df.precip[df.DateTime==t]-df.precip[df.DateTime==t-relativedelta(hours=1)]
dat = {'DateTime' : t, 'precipitation' : precip_1}
correct_precip.append(dat)
else:
dat = {'DateTime' : t, 'precipitation' : df.precip[df.DateTime==t]}
correct_precip.append(dat)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment