perform rebinning on data