def _compute_derivatives(self):
derivatives = []<EOL>for i, (timestamp, value) in enumerate(self.time_series_items):<EOL><INDENT>if i > <NUM_LIT:0>:<EOL><INDENT>pre_item = self.time_series_items[i - <NUM_LIT:1>]<EOL>pre_timestamp = pre_item[<NUM_LIT:0>]<EOL>pre_value = pre_item[<NUM_LIT:1>]<EOL>td = timestamp - pre_timestamp<EOL>derivative = (value - pre_value) / td if td != <NUM_LIT:0> else value - pre_value<EOL>derivative = abs(derivative)<EOL>derivatives.append(derivative)<EOL><DEDENT><DEDENT>if derivatives:<EOL><INDENT>derivatives.insert(<NUM_LIT:0>, derivatives[<NUM_LIT:0>])<EOL><DEDENT>self.derivatives = derivatives<EOL>
Compute derivatives of the time series.