I notice the following strange behavior with rankdata with maksed_array. Here is the code:
import numpy as np
import scipy.stats as stats
m = [True, False]
print(stats.mstats.rankdata(np.ma.masked_array([1.0, 100], mask=m)))
# result [0. 1.]
print(stats.mstats.rankdata(np.ma.masked_array([1.0, np.nan], mask=m)))
# result [1. 0.]
print(stats.mstats.rankdata([1.0, np.nan]))
# result [1. 2.]
According the scipy doc, masked values will be assigned 0 (use_missing=False). So why it outputs [1 0] in the 2nd one? Bug?