The comprehensive study of the temperature dependent x-ray absorption spectroscopy (XAS) reveals a dynamical spectral weight $\alpha$ in YBa$_2$Cu$_3$O$_y$ (YBCO). Large spectral weight changes for both the Upper Hubbard band and the Zhang-Rice band due to dynamics of holes are experimentally found in the underdoped regime. A large value of $\alpha \geq 0.3$ is indispensable to describing XAS of YBCO with the conservation of states. The value of $\alpha$ is linearly proportional to the pseudogap temperature in the underdoped regime, but becomes smaller as the doping level goes to the undoped limit. Our results clearly indicate that the pseudogap is related to the double occupancy and originates from bands in higher energies.