I am trying to obtain the equation of a best fitted plane to a cluster of 3d points in python. I run into a problem when all of my points are on the same plane, for example z=0. My minimum eigenvalue obtained from my matrix ends up being 0 and so does the corresponding eigenvector. Thus my equation ends up being empty.

I sort of get the correct result if i use a really low value like 0.0001 instead of 0, but is there a way around this? I rather use the original data.