Skip to content

Commit

Permalink
Merge pull request #610 from webbsledge/webbsledge-patch-2
Browse files Browse the repository at this point in the history
Fix deprecation warning in Pandas method 'pct_change'
  • Loading branch information
robertmartin8 authored Nov 30, 2024
2 parents 2940519 + a4e2ee5 commit f3d2eaa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pypfopt/expected_returns.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ def returns_from_prices(prices, log_returns=False):
:rtype: pd.DataFrame
"""
if log_returns:
returns = np.log(1 + prices.pct_change()).dropna(how="all")
returns = np.log(1 + prices.pct_change(fill_method=None)).dropna(how="all")
else:
returns = prices.pct_change().dropna(how="all")
returns = prices.pct_change(fill_method=None).dropna(how="all")
return returns


Expand Down

0 comments on commit f3d2eaa

Please sign in to comment.