Impose binary constraint on integer matrix with CVXPY

So I have the following matrix:

$$$$P_{i,j}= \begin{bmatrix} x_0 & x_1 & x_2 \\ y_0 & y_1 & y_2 \\ z_0 & z_1 & z_2 \end{bmatrix}$$$$

where each of the elements in the matrix are binary variables (can be either 0 or 1). I am solving an optimization problem where I want to impose a constraint where each of the rows of the matrix have to have $$n$$ number of zeros. So for example, for the first row of matrix $$P$$ (containing the $$x_i$$ elements), I want to enfore that for this row, I want one of these $$x_i$$'s to be zero (but not explicitly stating which one should be zero). As a second example, for the second row of matrix $$P$$ (containing the $$y_i$$ elements), I want to enfore that for this row, I want two of these $$y_i$$'s to be zero (but not explicitly stating which ones should be zero). And so fourth...

Is there a way to make this kind of formulation? I was thinking of imposing the constraints as follows:

$$\sum_j P_{1,j} = 2$$

$$\sum_j P_{2,j} = 1$$

Would this be the correct approach?

Your help would be much appreciated!

Set boolean=True for the matrix variable P, and use the constraints you have proposed.