To multiply a constant with a specific column or row:
import numpy as np;
X=np.ones(shape=(10,10),dtype=np.float64);
X;
### this is our default matrix
array([[1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
[1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
[1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
[1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
[1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
[1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
[1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
[1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
[1., 1., 1., 1., 1., 1., 1., 1., 1., 1.],
[1., 1., 1., 1., 1., 1., 1., 1., 1., 1.]])
## now say we want to multiple it with 10
X=X*10;
array([[10., 10., 10., 10., 10., 10., 10., 10., 10., 10.],
[10., 10., 10., 10., 10., 10., 10., 10., 10., 10.],
[10., 10., 10., 10., 10., 10., 10., 10., 10., 10.],
[10., 10., 10., 10., 10., 10., 10., 10., 10., 10.],
[10., 10., 10., 10., 10., 10., 10., 10., 10., 10.],
[10., 10., 10., 10., 10., 10., 10., 10., 10., 10.],
[10., 10., 10., 10., 10., 10., 10., 10., 10., 10.],
[10., 10., 10., 10., 10., 10., 10., 10., 10., 10.],
[10., 10., 10., 10., 10., 10., 10., 10., 10., 10.],
[10., 10., 10., 10., 10., 10., 10., 10., 10., 10.]])
### Now if, we want to mulitply 3,5, 7 column with 5
X[:,[3,5,7]]=X[:,[3,5,7]]*5
array([[10., 10., 10., 50., 10., 50., 10., 50., 10., 10.],
[10., 10., 10., 50., 10., 50., 10., 50., 10., 10.],
[10., 10., 10., 50., 10., 50., 10., 50., 10., 10.],
[10., 10., 10., 50., 10., 50., 10., 50., 10., 10.],
[10., 10., 10., 50., 10., 50., 10., 50., 10., 10.],
[10., 10., 10., 50., 10., 50., 10., 50., 10., 10.],
[10., 10., 10., 50., 10., 50., 10., 50., 10., 10.],
[10., 10., 10., 50., 10., 50., 10., 50., 10., 10.],
[10., 10., 10., 50., 10., 50., 10., 50., 10., 10.],
[10., 10., 10., 50., 10., 50., 10., 50., 10., 10.]])
Similarly, we can do it for any columns.
Hope it clarifies.