Fixed monthly data iterator to return correct dates and moved data cleanup notebook to 'backtester/demos/'

This commit is contained in:
Javier Rodríguez Chatruc
2020-01-07 16:27:26 -03:00
parent dd667440f4
commit 6a40398665
2 changed files with 3 additions and 4 deletions
@@ -36,10 +36,9 @@ class HistoricalOptionsData:
def iter_months(self):
"""Returns `pd.DataFrameGroupBy` that groups contracts by month"""
date_col = self.schema["date"]
iterator = self._data.groupby(
pd.Grouper(key=date_col,
freq="MS")).apply(lambda g: g[g[date_col] == g[date_col].min()]).reset_index(drop=True).groupby(
pd.Grouper(key=date_col, freq="MS"))
iterator = self._data.groupby(pd.Grouper(
key=date_col,
freq="MS")).apply(lambda g: g[g[date_col] == g[date_col].min()]).reset_index(drop=True).groupby(date_col)
return iterator
def __getattr__(self, attr):