Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all(::TimeSeries)? #356

Closed
dourouc05 opened this issue Dec 24, 2017 · 4 comments
Closed

all(::TimeSeries)? #356

dourouc05 opened this issue Dec 24, 2017 · 4 comments

Comments

@dourouc05
Copy link
Contributor

Following a recent trend of addition of methods (like #338), would something like all()be interesting? I am currently comparing two time series, and a simple == generates a warning:

WARNING: ==(ta::TimeArray, args...) is deprecated, use ==.(ta, args...) instead.

I have thus switched to ==., and I have a time series of Booleans, instead of a single Boolean. I would like all(ta) to return all(ta.value) when that makes sense (I am only thinking of having one Boolean column and no other column). Then, any() could be implemented similarly (and maybe others).

This is more a request for comments; I can provide an implementation if you think this is worthwhile.

@iblislin
Copy link
Collaborator

Following a recent trend of addition of methods (like #338), would something like all() be interesting?

I agree with that we should support more reduction functions like all and any,
but the next problem is the return type. Should it be a scalar, be a TimeArray or depends?

@dourouc05
Copy link
Contributor Author

dourouc05 commented Dec 24, 2017

When there is only one column, I think the answer is quite obvious (take the all of the values of this single column, meaning a single Bool). However, when there are multiple columns (only Booleans), it might make sense to do it line by line (i.e. return a new time series with just one column of Bool).

@iblislin
Copy link
Collaborator

iblislin commented Dec 25, 2017

First, for your need, I think we need to revoke the deprecation warning of == and redefine its meaning as 'Does two TimeArray share exactly same fields?`

Second, about all, any and etc, I will prefer to return a TImeArray like other reduction function (sum, mean) does. Since TimeArray is a tabular data structure and it has two dimesion,
in order to do reduction, you need to specificy the dimension (the default is along the columnes).
That's what #338 does: e.g. sum give you a TImeArray with latest timestamp.
I want to keep consistent on all and any.
Futhermore, I will expect the reduction function shares same result with moving(..., full_length)
e.g. moving(sum, cl, length(cl)) equals to sum(cl).

iblislin added a commit that referenced this issue Dec 25, 2017
@iblislin
Copy link
Collaborator

you might want to try out #359

iblislin added a commit that referenced this issue Jul 23, 2018
iblislin added a commit that referenced this issue Jul 23, 2018
* basemisc: add `all` and `any`

Fix #356

* basemisc: test cases for all and any

* Update NEWS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants