Binned statistic

Closes issue #3063