updated some tests
This commit is contained in:
parent
c453ff20e5
commit
2f50894b46
@ -809,6 +809,7 @@ class TimeSeries(TimeSeriesCore):
|
|||||||
to_frequency: Literal["W", "M", "Q", "H", "Y"],
|
to_frequency: Literal["W", "M", "Q", "H", "Y"],
|
||||||
method: Literal["sum", "mean"],
|
method: Literal["sum", "mean"],
|
||||||
eomonth: bool = False,
|
eomonth: bool = False,
|
||||||
|
ensure_coverage: bool = True,
|
||||||
anchor_date=Literal["start", "end"],
|
anchor_date=Literal["start", "end"],
|
||||||
) -> TimeSeries:
|
) -> TimeSeries:
|
||||||
"""Transform a time series object into a lower frequency object with an aggregation function.
|
"""Transform a time series object into a lower frequency object with an aggregation function.
|
||||||
@ -851,7 +852,7 @@ class TimeSeries(TimeSeriesCore):
|
|||||||
self.start_date,
|
self.start_date,
|
||||||
self.end_date, # + relativedelta(days=to_frequency.days),
|
self.end_date, # + relativedelta(days=to_frequency.days),
|
||||||
to_frequency.symbol,
|
to_frequency.symbol,
|
||||||
ensure_coverage=True,
|
ensure_coverage=ensure_coverage,
|
||||||
eomonth=eomonth,
|
eomonth=eomonth,
|
||||||
)
|
)
|
||||||
# prev_date = dates[0]
|
# prev_date = dates[0]
|
||||||
|
1
setup.py
1
setup.py
@ -2,6 +2,7 @@ from setuptools import find_packages, setup
|
|||||||
|
|
||||||
license = open("LICENSE").read().strip()
|
license = open("LICENSE").read().strip()
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="pyfacts",
|
name="pyfacts",
|
||||||
version="0.0.1",
|
version="0.0.1",
|
||||||
|
@ -374,7 +374,7 @@ class TestTransform:
|
|||||||
def test_daily_to_weekly(self, create_test_data):
|
def test_daily_to_weekly(self, create_test_data):
|
||||||
ts_data = create_test_data(AllFrequencies.D, num=782, skip_weekends=True)
|
ts_data = create_test_data(AllFrequencies.D, num=782, skip_weekends=True)
|
||||||
ts = TimeSeries(ts_data, "D")
|
ts = TimeSeries(ts_data, "D")
|
||||||
tst = ts.transform("W", "mean")
|
tst = ts.transform("W", "mean", ensure_coverage=False)
|
||||||
assert isinstance(tst, TimeSeries)
|
assert isinstance(tst, TimeSeries)
|
||||||
assert len(tst) == 157
|
assert len(tst) == 157
|
||||||
assert "2017-01-30" in tst
|
assert "2017-01-30" in tst
|
||||||
|
Loading…
Reference in New Issue
Block a user