ffill and bfill now return TimeSeries objects instead of lists

This commit is contained in:
Gourav Kumar 2022-02-20 21:51:54 +05:30
parent 2c1d508734
commit 439fa86b5c

View File

@ -75,7 +75,7 @@ class TimeSeries(TimeSeriesCore):
self.time_series = new_ts self.time_series = new_ts
return None return None
return new_ts return TimeSeries(new_ts, frequency=self.frequency.symbol)
def bfill(self, inplace: bool = False, limit: int = None) -> Union[TimeSeries, None]: def bfill(self, inplace: bool = False, limit: int = None) -> Union[TimeSeries, None]:
"""Backward fill missing dates in the time series """Backward fill missing dates in the time series
@ -109,7 +109,7 @@ class TimeSeries(TimeSeriesCore):
self.time_series = new_ts self.time_series = new_ts
return None return None
return new_ts return TimeSeries(new_ts, frequency=self.frequency.symbol)
def calculate_returns( def calculate_returns(
self, self,