Calculate statistics (Mean/STD) on Temporal Time Series


#1

Hi,
I would like to calculate some basic statistics on a TimeSeries - mean and standard deviation, however I get an error:

std(ts_data[:RandomWalk])
ERROR: MethodError: no method matching /(::Tuple{Date,Array{Float64,1}}, ::Int64)

What is the correct way of doing this:

using Temporal, Base.Dates
date_array=collect(Dates.today()-Day(365):Day(1):today())
random_walk = cumsum(randn(length(date_array)))+100.00
ts_data = TS(random_walk, date_array, :RandomWalk)
std(ts_data[:RandomWalk])

Thank you for your help!


#2

replace the last line

std((ts_data[:RandomWalk]).values)

… or submit an issue about this to Temporal.jl on github (or both)


#3

with all Temporal.jl series, you can take a column temporal_series[:colname] and get its values (shorn of the dates) as a vector:

temporal_series[:colname].values

and you can get the dates as a vector:

temporal_series.index