scicloj / tablecloth.time

Tools for the processing and manipulation of time-series data in Clojure.
Other
18 stars 1 forks source link

adds rolling window support #15

Closed rsiddharthan closed 3 years ago

rsiddharthan commented 3 years ago

Adds rolling window feature to a tablecloth dataset. This initial work supports integer and time based indices, and simple fixed length windows which contain the set of rows. preceding the current row.

rsiddharthan commented 3 years ago

Refactored code and switched to using updated slice function.

TODO #1. Switch to the new group-by that supports ordered datasets TODO #2. Discuss if rolling-window can operate on index. It will require changed to slice to do the same

rsiddharthan commented 3 years ago

Checked in version is an ordered dataset.

TODO: Add sample test cases for time based indices.

rsiddharthan commented 3 years ago

Checked in support for column-name in function signatures. This allows both int based and time based indices to work

ezmiller commented 3 years ago

@rsiddharthan the tests are failing, I think because midje needs to be included in the project dependencies in project.clj. The error:

Could not locate midje/sweet__init.class, midje/sweet.clj or midje/sweet.cljc on classpath.

ezmiller commented 3 years ago

@rsiddharthan I added the midje dependency to project.clj (here), but I'm still getting an error:

 Syntax error compiling at (tablecloth/time/api/rolling_window_test.clj:7:1).
Unable to find column {{:loc 0}=[0], {:loc 1}=[0 1], {:loc 2}=[0 1 2], {:loc 3}=[1 2 3], {:loc 4}=[2 3 4], {:loc 5}=[3 4 5], {:loc 6}=[4 5 6], {:loc 7}=[5 6 7], {:loc 8}=[6 7 8], {:loc 9}=[7 8 9]}

Tried to understand it but nothing jumped out at me. Maybe it will be familiar to you.

ezmiller commented 3 years ago

@rsiddharthan the command I ran to run your tests on your new test file on the command line was

lein midje tablecloth.time.api.rolling-window-test