REF: give rank1d/2d same nan filling
A piece broken off the `rank_2d` deduplication

@mzeitlin11 do the stubs need updating for the extra function and extra parameter? > @mzeitlin11 do the stubs need updating for the extra function and extra parameter?

This added function (and the function with a new param) can only be called from `Cython` code, so compilation should handle type checking correctness. For another internal function `kth_smallest_c`, I don't see it typed in `algos.pyi`, so I don't think anything needs to be added. > > @mzeitlin11 do the stubs need updating for the extra function and extra parameter?
> 
> This added function (and the function with a new param) will only be called from `Cython` code, so compilation should handle type checking correctness. For another internal function `kth_smallest_c`, I don't see it typed in `algos.pyi`, so I don't think anything needs to be added.



> > @mzeitlin11 do the stubs need updating for the extra function and extra parameter?
> 
> This added function (and the function with a new param) will only be called from `Cython` code, so compilation should handle type checking correctness. For another internal function `kth_smallest_c`, I don't see it typed in `algos.pyi`, so I don't think anything needs to be added.

I see. they are both cdef so not exposed to Python.