code: def _transform(self, data, transform, step_size):
      '''
      Transform the data. If the transform is not supported by this series,
      returns the data unaltered.
      '''
      if transform=='mean':
        total = sum( data )
        count = len( data )
        data = float(total)/float(count) if count>0 else 0
      elif transform=='count':
        data = len(data)
      elif transform=='min':
        data = min(data or [0])
      elif transform=='max':
        data = max(data or [0])
      elif transform=='sum':
        data = sum(data)
      elif transform=='rate':
        data = len(data) / float(step_size)
      elif callable(transform):
        data = transform(data)
      return datf _transform(self, data, transform, step_size):
      '''
      Transform the data. If the transform is not supported by this series,
      returns the data unaltered.
      '''
      if transform=='mean':
        total = sum( data )
        count = len( data )
        data = float(total)/float(count) if count>0 else 0
      elif transform=='count':
        data = len(data)
      elif transform=='min':
        data = min(data or [0])
      elif transform=='max':
        data = max(data or [0])
      elif transform=='sum':
        data = sum(data)
      elif transform=='rate':
        data = len(data) / float(step_size)
      elif callable(transform):
        data = transform(data)
      return data
docs: Transform the data. If the transform is not supported by this series,
      returns the data unaltered.