Fix stats.scoreatpercentile

Fix ndarray input for ``per`` parameter and empty input. Closes gh-1897 and gh-2861.