<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def subsample(self, sample_factor=2):
 """ Subsample series by an integer factor. Parameters sample_factor : positive integer, optional, default=2 Factor for downsampling. """

        if sample_factor < 0:
            raise Exception('Factor for subsampling must be postive, got %g' % sample_factor)
        s = slice(0, len(self.index), sample_factor)
        newindex = self.index[s]
        return self.map(lambda v: v[s], index=newindex)