ENH: Optimise sparsefuncs
a] Removed numpy overhead in finding mean
b] Removed enumerate
c] Added tests to test_sparsefuncs
d] Replaced multiple looping with a single loop