To calculate the percent change in stock prices, we can simply subtract the stock price on the previous day from the stock price on the current day, and divide by the previous day's stock price .

A.I. Evaluation of the Solution

The candidate's solution is optimal because it uses the built-in pct_change() function in pandas.

Evaluated at: 2022-11-14 04:15:59