DEP: Replace np.rank by np.ndim.

The rank function is going to be deprecated as folks new to numpy
tend to confuse it with matrix rank.