scicloj / tablecloth.time

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

Make indexing tools simpler #45

Closed ezmiller closed 3 years ago

ezmiller commented 3 years ago

Goal / Problem

Two different problems here:

Proposed Solution

This PR adds a new function get-index-column-or-error that in many cases may be all that we need to import for an index-aware function. This function will return the index column, or if it cannot figure out which one is the time index, it will throw a standard error that asks the user to use index-by to specify the index.

I also added a sibling fn get-index-column-name-or-error, that may be useful when we only need to know the index column name.

ezmiller commented 3 years ago

@rsiddharthan Thank you for taking a look at this! 🙏 There's a follow-on PR that changes the API for adjust-interval a bit, and bringing it inline with what we have in slice and rolling-window.