A logarithmic return is the natural logarithm of an asset’s ending-price-to-starting-price ratio. Unlike a simple return, it measures a continuously compounded rate, making it useful for statistical analysis. section 3.4.2
Calculate returns with pandas and NumPy
For a closing-price DataFrame, calculate each period’s return with `np.log(close / close.shift())`, then remove the initial missing value with `dropna()`. Plot the resulting series as a histogram to inspect outliers. section 3.4.2
import numpy as np log_rets = hist_prices_24["Close"].apply(lambda x: np.log(x / x.shift())).dropna() log_rets
Inspect the executable calculation of logarithmic returns from historical closing prices. section 3.4.2

