Skip to content

Commit

Permalink
Aggregate - Adapt to different behaviour of stats.mode (keepdims=Fals…
Browse files Browse the repository at this point in the history
…e by default now)
  • Loading branch information
PrimozGodec committed Aug 24, 2023
1 parent 97c25a9 commit 305929b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions orangecontrib/timeseries/aggregate.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ def windowed_cumprod(x, width, shift):

def windowed_mode(x, width, shift):
modes, counts = windowed_func(
partial(stats.mode, nan_policy='omit'),
# keepdims argument can be removed when we require scipy>=1.11
partial(stats.mode, nan_policy='omit', keepdims=False),
x, width, shift)
modes = modes[:, 0]
if np.ma.isMaskedArray(modes):
# If counts == 0, all values were nan
modes = modes.data
modes[counts[:, 0] == 0] = np.nan
modes[counts == 0] = np.nan
return modes


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
'pandas', # statsmodels requires this but doesn't have it in dependencies?
'pandas_datareader',
'numpy',
'scipy>=0.17',
'scipy>=1.9.2',
'more-itertools',
# required to get current timezone
# adding it does not hurt, Pandas have it as a dependency
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ deps =
# orange3 requires the following
oldest: orange-widget-base==4.18.0
oldest: orange-canvas-core==0.1.27
oldest: scipy==1.9.2
latest: https://github.com/biolab/orange3/archive/refs/heads/master.zip#egg=orange3
latest: https://github.com/biolab/orange-canvas-core/archive/refs/heads/master.zip#egg=orange-canvas-core
latest: https://github.com/biolab/orange-widget-base/archive/refs/heads/master.zip#egg=orange-widget-base
Expand Down

0 comments on commit 305929b

Please sign in to comment.