If you don't mind using an additional package, scipy.optimize has a number of methods that would be perfect. Otherwise, you could implement your own zero finding function.
If you want to go the scipy route:
1) Define your problem as a function that takes your unknown parameter (P) as its first argument, and returns the value you want to minimize:
def zerofn(P, x, y):
return np.linalg.det(x - y(P))
2) Optimize this function, using scipy. The example here uses a simple Newton-Raphson zero finder, but there are many other options which you might want to use to specify parameter bounds (e.g. P > 0).
import scipy.optimize as opt
opt.newton(zerofn, x0=1, args=(x, y))
>> 160.25865914054651
The result of this zero finder is your optimized value of P.