Skip to content

Commit

Permalink
Fixed a bug of empty list being ignored by AndAggregator (#77)
Browse files Browse the repository at this point in the history
* fixed a bug

* updated version number

* updated changelog

* fixed typos

* avoided pandas warning
  • Loading branch information
tailaiw committed Feb 24, 2020
1 parent 3b44204 commit 0952680
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Expand Up @@ -66,7 +66,7 @@
# The short X.Y version.
version = "0.5"
# The full version, including alpha/beta/rc tags.
release = "0.5.5-dev.1+pr.70"
release = "0.5.5"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
5 changes: 3 additions & 2 deletions docs/releasehistory.rst
Expand Up @@ -2,9 +2,10 @@
Release History
***************

Version 0.5.5-dev
Version 0.5.5 (Feb 24, 2020)
===================================
- Fixed some typo in the documentation (0.5.5-dev.1+pr.70)
- Fixed a bug that empty lists were ignored by AndAggregator
- Fixed some typo in the documentation

Version 0.5.4 (Feb 18, 2020)
===================================
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
@@ -1,6 +1,6 @@
[metadata]
name = adtk
version = 0.5.5-dev.1+pr.70
version = 0.5.5
author = Arundo Analytics, Inc.
maintainer = Tailai Wen
maintainer_email = tailai.wen@arundo.com
Expand Down
2 changes: 1 addition & 1 deletion src/adtk/__init__.py
Expand Up @@ -20,4 +20,4 @@
"""

__version__ = "0.5.5-dev.1+pr.70"
__version__ = "0.5.5"
2 changes: 2 additions & 0 deletions src/adtk/aggregator/aggregator.py
Expand Up @@ -118,6 +118,7 @@ def _predict_core(self, lists):
for window in clean_predict
]
),
dtype="int",
).sort_index()
for key, clean_predict in clean_lists.items()
}
Expand All @@ -129,6 +130,7 @@ def _predict_core(self, lists):
pd.concat(time_window_stats, axis=1, join="outer")
.fillna(method="ffill")
.fillna(method="bfill")
.fillna(0)
)
time_window_stats = time_window_stats.all(axis=1)
status = 0
Expand Down
24 changes: 24 additions & 0 deletions tests/test_aggregators.py
Expand Up @@ -29,6 +29,20 @@ def test_or_dict_of_lists():
Timestamp("2017-1-11"),
]

lists = {
"A": [
(Timestamp("2017-1-1"), Timestamp("2017-1-2")),
(Timestamp("2017-1-5"), Timestamp("2017-1-8")),
Timestamp("2017-1-10"),
],
"B": [],
}
assert aggt.OrAggregator().aggregate(lists) == [
(Timestamp("2017-1-1"), Timestamp("2017-1-2")),
(Timestamp("2017-1-5"), Timestamp("2017-1-8")),
Timestamp("2017-1-10"),
]


def test_or_df():
"""
Expand Down Expand Up @@ -93,6 +107,16 @@ def test_and_dict_of_lists():
(Timestamp("2017-1-7 00:00:00"), Timestamp("2017-1-8 00:00:00")),
]

lists = {
"A": [
(Timestamp("2017-1-1"), Timestamp("2017-1-2")),
(Timestamp("2017-1-5"), Timestamp("2017-1-8")),
Timestamp("2017-1-10"),
],
"B": [],
}
assert aggt.AndAggregator().aggregate(lists) == []


def test_and_df():
"""
Expand Down

0 comments on commit 0952680

Please sign in to comment.