JuliaStats / TimeSeries.jl

Time series toolkit for Julia
Other
349 stars 69 forks source link

Initializing with duplicate timestamp values #506

Open CGenie opened 2 years ago

CGenie commented 2 years ago

Hello, I have this data:

    data = (
        timestamp=[Dates.DateTime(2022, 1, 1, 10, 0),
                   Dates.DateTime(2022, 1, 1, 10, 0)],
        col=[1, 2]
    )
    ta = TimeArray(data, timestamp=:timestamp)

As you see, the date is duplicated. Is there a way to "compress" this so that there is a single timestamp while the values is a list [1, 2]? Because currently it is treated as:

2×1 TimeArray{Int64, 2, DateTime, Matrix{Int64}} 2022-01-01T10:00:00 to 2022-01-01T10:00:00
│                     │ col   │
├─────────────────────┼───────┤
│ 2022-01-01T10:00:00 │ 1     │
│ 2022-01-01T10:00:00 │ 2     │
ValentinKaisermayer commented 2 years ago

I think you would have to alter the data first but you can instantiate TimeArrays with anything as column type:

TimeSeries.TimeArray([Dates.DateTime(2022,01,01)],[[1,2]])