Numpy doesn't have built-in support for finite fields. The matrix A
in your code is treated as a matrix of real numbers, and hence has rank 2.
If you really need to support finite fields with Numpy, you'll have to define your own data type along with the arithmetic operations yourself, as shown here. There are of course the concerns about proper error handling (like divide by zero).
Even then, many common routines will have to be rewritten to support your field data types. For example, from the numpy.linalg.matrix_rank documentation, the routine uses Singular Value Decomposition (SVD), which is not well defined for finite fields, so you'll have to code the rank finding algorithm yourself.
As for the algorithm itself, you could try implementing plain old Gaussian Elimination along these lines, but this can be a pain in the neck and really slow, so you will likely be better off with other tools/packages like Sage.