Skip to content

Commit

Permalink
time_binnings: store thresholds as np.array
Browse files Browse the repository at this point in the history
  • Loading branch information
janezd committed Mar 9, 2022
1 parent f07d597 commit c00df78
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Orange/preprocess/discretize.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def _time_binnings(mn, mx, min_pts, max_pts):
if not times:
continue
times = [time.struct_time(t + (0, 0, 0)) for t in times]
thresholds = [calendar.timegm(t) for t in times]
thresholds = np.array([calendar.timegm(t) for t in times])
labels = [time.strftime(fmt, t) for t in times]
short_labels = _simplified_labels(labels)
if place == 2 and step >= 7:
Expand Down
3 changes: 2 additions & 1 deletion Orange/preprocess/tests/test_discretize.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def tr(ss):

def testbin(start, end):
bins = _time_binnings(create(*start), create(*end), 3, 51)
return [(bin.width_label, tr(bin.short_labels), bin.thresholds)
return [(bin.width_label, tr(bin.short_labels),
list(bin.thresholds))
for bin in reversed(bins)]

self.assertEqual(
Expand Down

0 comments on commit c00df78

Please sign in to comment.