Logarithmic returns in pandas dataframe

df['pct_change'] = df.price.pct_change()
df['log_return'] = np.log(1 + df.pct_change)

pct_change: percentage change

Published 128 original articles · won praise 90 · views 4884

Guess you like

Origin blog.csdn.net/weixin_45405128/article/details/102681492