TimeSeries.jl icon indicating copy to clipboard operation
TimeSeries.jl copied to clipboard

Mutating time series

Open imbrem opened this issue 5 years ago • 3 comments

While I understand the point of disallowing inserting new data points into the middle of a time series (which is immutable), since we already support update and rename!, I think it may be helpful to have functions which:

  • Add new columns (reallocating the backing array)
  • Map a column, replacing it with its result. This would especially be useful for, e.g., NaN removal

Potentially, we could also support filter! to filter a TimeArray in place, as this would not add any date points and would not affect the fact that the TimeArray is sorted. Thoughts?

imbrem avatar Jun 04 '20 18:06 imbrem

Add new columns (reallocating the backing array)

I think merge or hcat already done this? IIRC, these functions do copy.

iblislin avatar Jun 06 '20 18:06 iblislin

shall we have setindex(ta, column, name) to update/insert a column?

clouds56 avatar Jun 29 '21 07:06 clouds56

There is a plan for adding a dynamic length type: https://github.com/JuliaStats/TimeSeries.jl/issues/482#issuecomment-777379241 So that new type can serve for insert/delete columns.

About update: the inplaced update operations are fine for a static length TimeArray. I think it's okay to just add setindex!(ta, ::Vector, name::Symbol) for it.

iblislin avatar Jun 29 '21 13:06 iblislin