OnlineStats at Series how to get numer of case? s.n , n(s) not works

using OnlineStats, Distributed
julia> s = @distributed merge for i in 1:3
fit!(Series(Mean()), randn(10_000))
end
Series
└── Mean: n=30000 | value=0.0018463
julia> s.stats
(Mean: n=30000 | value=0.00170161,)

julia> value(s)
(0.0017016120916806031,)

julia> n(s)

ERROR: UndefVarError: n not defined
Stacktrace:
 [1] top-level scope at none:0

julia> s.n
ERROR: type Series has no field n
Stacktrace:
 [1] getproperty(::Any, ::Symbol) at .\sysimg.jl:18

Paul

s.stats[1].n

(you can work this out by doing fieldnames(typeof(s.stats)) and then fieldnames(typeof(s.stats[1])) once you’ve found out that the field of s.stats is called 1)

You can use nobs(s).

2 Likes