Added functionality to handle weighted data.

And tests, and Pandas interface.