In the textbook "Reinforcement Learning: An Introduction", by Richard Sutton and Andrew Barto, the pseudo code for Policy Evaluation is given as follows:
The update equation for $V(s)$ comes from the Bellman equation for $v_{\pi}(s)$ which is mentioned below (the update equation) for your convenience: $$v_{k+1}(s) = \sum_{a} \pi(a|s)\sum_{s',r}p(s',r|s,a)[r+\gamma v_{k}(s')]$$
Now, in Policy Iteration, the Policy Evaluation comes in stage 2, as mentioned in the following pseudo code:
Here, in the policy Evaluation stage, $V(s)$ is updated using a different equation: $$\begin{align} v_{k+1}(s) = \sum_{s',r}p(s',r|s,\pi (s))[r + \gamma v_{k}(s)] \end{align}$$ where $a = \pi(s)$ is used.
Can someone please help me in understanding why this change is made in Policy Iteration? Are the two equations the same?