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

Proposal: user-defined time index interface #167

Open
sairus7 opened this issue Oct 10, 2023 · 1 comment
Open

Proposal: user-defined time index interface #167

sairus7 opened this issue Oct 10, 2023 · 1 comment

Comments

@sairus7
Copy link

sairus7 commented Oct 10, 2023

Some time ago there was a detailed discussion about TimeSeries.jl functionality. In particular there was an idea to define a separate timestamps vector that support different time types: JuliaStats/TimeSeries.jl#482 (comment)

The main reason for it is to support different time representations:

Is there any plans or interest to support such functionality in this package?

@chiraganand
Copy link
Member

chiraganand commented Mar 19, 2024

Some time ago there was a detailed discussion about TimeSeries.jl functionality. In particular there was an idea to define a separate timestamps vector that support different time types: JuliaStats/TimeSeries.jl#482 (comment)

TSFrames already separates out index from data. In its simplest form:

struct TSFrame
    coredata :: DataFrame
end

The first column of the DataFrame is the index. This is done to provide the flexibility to support other types of index.

Having said that, there is plan to implement custom typed index for TSFrame. Currently, the index is <: Union{Int, TimeType} but it can, essentially, be any type as long as it can be sorted (I can't remember anything else but I am sure there are a few other constraints).

There is some related discussion in #151.

The main reason for it is to support different time representations:

As I mentioned above, ideally, these should be possible.

  • scales from milliseconds to days and years,

This is already possible with DateTime index. There are functions to support this scaling like to_period() and endpoints(). For applying a function over a period there is apply().

If I understand from what you are asking, this indexing is already possible. See: https://xkdr.github.io/TSFrames.jl/stable/user_guide/#Indexing-and-subsetting
For some reason, the API reference doc isn't being generated for all the getindex() overloads but you can look at the source here: https://github.com/xKDR/TSFrames.jl/blob/main/src/getindex.jl.

Is there any plans or interest to support such functionality in this package?

Already answered above.

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