Perhaps not such a big deal, but it breaks my heart to follow this:
deltas = data[1:] - data[:-1]
with this:
for i in range(len(deltas)):
if deltas[i] < 0: deltas[i] = 0
if deltas[i] > 100: deltas[i] = 0
For this particular example...is there a better way to do the cleansing part?
Question part two: What if the cleansing rules are more complicated, or less complicated than this example. For example, we might just want to change all negative numbers to zero. Or, we might be doing a more complicated mapping.