'Args:
ds (DataFlow): input DataFlow.
func (TYPE -> TYPE|None): takes ``dp[index]``, returns a new value for ``dp[index]``.
return None to discard this datapoint.
Note that if you use the filter feature, ``ds.size()`` will be incorrect.
index (int): index of the component.
Note:
This proxy itself doesn\'t modify the datapoints.
But please make sure func doesn\'t modify the components
unless you\'re certain it\'s safe.'

def __init__(self, ds, func, index=0):

    def f(dp):
        r = func(dp[index])
        if (r is None):
            return None
        dp = copy(dp)
        dp[index] = r
        return dp
    super(MapDataComponent, self).__init__(ds, f)
