BUG: stats.rankdata returned incorrect results for ties with a large number of elements.

Instead of accumulating the ranks of the tied elements, a simple formula is used
for the average rank.
PEP8 tweaks.
Merge pull request #436 from WarrenWeckesser/bug-rankdata

BUG: stats.rankdata returned incorrect results for ties with a large number of elements