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

Feature Request: Add support for Dates.DateTime or equivalent date/time type on x-axis for TimeseriesTools.TimeSeries #6

Open
gsalaz98 opened this issue Aug 1, 2023 · 1 comment

Comments

@gsalaz98
Copy link

gsalaz98 commented Aug 1, 2023

Hello,

Thank you for this project. I think it's awesome and very much needed in the ecosystem.

I tried using the package to create a time series indexed by Dates.DateTime types, but noticed that there's no first-class support for it yet.

Are there any plans or desire to add that capability in the future? I might be able to contribute some time to the codebase to add that functionality (if I find the time).

Thank you!

@brendanjohnharris
Copy link
Owner

Hey Gerardo, glad you like the package!

DateTimes should work fine when constructing an AbstractTimeSeries:

x = 1:100
t = DateTime(1901):Year(1):DateTime(2000);
y = TimeSeries(t, x)

And also for some of the simpler methods, such as:

y isa RegularTimeSeries # true
samplingperiod(y) # 1 year
duration(y) # 3124137600000 milliseconds. This would be in Years if e.g. t = Year(1):Year(1):Year(100)
times(y) # DateTime("1901-01-01T00:00:00"):Year(1):DateTime("2000-01-01T00:00:00")

Currently, some methods will fail, such as:

samplingrate(y) # / is undefined for DateTimes and Int's

as well as plotting (since Makie doesn't have recipes defined for DateTime's)

I don't work with DateTimes often (at all...), so I'm not sure what sorts of extra functionality it'd be useful to have for these types of time series. Let me know if you have specific functionality in mind, I'd be more than happy to have a go at adding it, or feel free to open a PR :)

(To make things a bit more convenient, I've just defined some types for DateTime indices: DateIndex, DateTimeIndex, and a DateTimeSeries).

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