Skip to content

Commit

Permalink
fix: replace deprecated last("12M")
Browse files Browse the repository at this point in the history
  • Loading branch information
chilango74 committed Feb 26, 2024
1 parent d7087b3 commit 0f3407f
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 163 deletions.
211 changes: 50 additions & 161 deletions main_notebook.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions okama/common/make_asset_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ def _assets_dividend_yield(self) -> pd.DataFrame:
div_yield = pd.Series(dtype=float)
div_monthly.index = div_monthly.index.to_timestamp()
for date in price_monthly_ts.index.to_timestamp(how="End"):
# TODO: FutureWarning: last is deprecated and will be removed in a future version. Please create a mask and filter using `.loc` instead
ltm_div = div_monthly[:date].last("12M").sum()
date0 = date - pd.DateOffset(months=12) # last 12 months
ltm_div = div_monthly[date0: date].sum()
last_price = price_monthly_ts.loc[:date].iloc[-1]
value = ltm_div / last_price
div_yield.at[date] = value
Expand Down

0 comments on commit 0f3407f

Please sign in to comment.