Weak value expansion of quantum operators and its application in stochastic matrices