Skip to content

Commit

Permalink
Fix deprecation warning in Pandas method 'pct_change'
Browse files Browse the repository at this point in the history
  • Loading branch information
webbsledge committed Nov 3, 2024
1 parent 2940519 commit a4e2ee5
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 a4e2ee5

Please sign in to comment.