Logarithmic return
A logarithmic return is the natural logarithm of an asset’s ending price divided by its beginning price over a period.
Statistics Every Programmer Needs
A log return is the natural logarithm of the ratio of an asset's current price to its previous price, representing a compounded proportional price change.
- How it is used
- Supports Monte Carlo simulation of future stock prices by summarizing historical daily movements.
- How deep it goes
- Defines the formula, implements it in Python, examines its distribution, and estimates mean and volatility for simulation.
- Examples
- Uses GM closing prices, a pandas log-return column, a density plot, and estimated mean and standard deviation.
- What you can do after
- Apply it via NumPy and pandas, then use estimated returns and volatility in a Monte Carlo forecast.
Read how Statistics Every Programmer Needs explains logarithmic return →
Investing for Programmers
A log return is the natural logarithm of the ratio between an asset's ending price and its starting price over a period.
- How it is used
- Uses logarithmic returns to compare daily market performance and support statistical analysis.
- How deep it goes
- Defines the metric, contrasts it with simple returns, demonstrates code, and stops short of deeper return theory.
- Examples
- Calculates returns for Apple, Coca-Cola, and NuScale closing-price data, then visualizes their distributions.
- What you can do after
- Apply logarithmic returns with pandas and NumPy, plot their distribution, and inspect potential outliers.
Read how Investing for Programmers explains logarithmic return →
Related concepts
- stock share priceuses · A stock share price is the market value of one share of a publicly traded company or security at a particular time.
- simple returnalternative to · Simple return is the proportional change in an asset’s value over a period, calculated as ending value divided by beginning value minus one.
- returnkind of · Investment return is the gain or loss produced by an investment or portfolio over a specified period, expressed as an amount or relative rate.
- normal distributionused by · A normal distribution is a continuous probability distribution with a symmetric, bell-shaped density determined by its mean and variance.
- dropnaused by · dropna is a pandas method that removes missing values or rows and columns containing them according to specified criteria.
- correlationused by · Correlation is a statistical relationship describing how two or more variables or quantities vary together, including the strength and direction of their association, without by itself implying causation.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

