The median is wrong for particular orderings of NaN and non-NaN elements.
Wrong:
>> la.larry([1, np.nan, np.nan, 2]).median()
1.0
Right:
>> la.larry([1, 2, np.nan, np.nan]).median()
1.5
>> la.larry([1, np.nan, 2, np.nan]).median()
1.5
The bug has been fixed in Bottleneck 0.5.0dev [1].
There are two possible fixes for users of la:
- Downgrade to la 0.4.0 (it does not use Bottleneck but, on the
downside, la 0.5.0 contains other bug fixes)
- Keep la 0.5.0 but upgrade to Bottleneck 0.5.0dev
[1] https://github.com/kwgoodman/bottleneck/commit/0fd01aa50623510c6032559acd82e2d30ac464e3