TSFrames.TSFrame
— Typestruct TSFrame
+ 0.108871 0.108871
diff --git a/dev/api/index.html b/dev/api/index.html
index e8dc8b1..74d5f30 100644
--- a/dev/api/index.html
+++ b/dev/api/index.html
@@ -30,7 +30,7 @@
0.586022 0.586022
0.0521332 0.0521332
0.26864 0.26864
- 0.108871 0.108871source A TSFrame object is essentially a Permitted data inputs to the constructors are Since Constructors Equality Equality First Row Returns the first row of Examples First Row Returns the first row of Examples Iterators Iterators Joins/Column-binding The following join types are supported: a.k.a. inner join, takes the intersection of the indexes of a.k.a. outer join, takes the union of the indexes of Left join takes the index values which are present in the left object Right join, similar to left join but works in the opposite direction. The final object contains all the rows from the right object while inserting The default behaviour is to assume Joining multiple where Examples Joins/Column-binding The following join types are supported: a.k.a. inner join, takes the intersection of the indexes of a.k.a. outer join, takes the union of the indexes of Left join takes the index values which are present in the left object Right join, similar to left join but works in the opposite direction. The final object contains all the rows from the right object while inserting The default behaviour is to assume Joining multiple where Examples Size methods Return the number of rows and columns of Examples Row-merging (vcat/rbind) Concatenate rows of two TSFrame objects, append The Currently, Examples Size methods Return the number of rows and columns of Examples Row-merging (vcat/rbind) Concatenate rows of two TSFrame objects, append The Currently, Examples Plotting Plotting Plots a TSFrame object with the index on the x-axis and selected Example Internal function to check consistency of the Index of a TSFrame object. Apply/Period conversion Internal function to check consistency of the Index of a TSFrame object. Apply/Period conversion Summary statistics Summary statistics Compute summary statistics of Examples Computing end points Computing end points Head Returns the first Examples Head Returns the first Examples Index column Return the index vector from the Examples Index column Return the index vector from the Examples Lagging Lag the Examples Lagging Lag the Examples Leading Similar to lag, this method leads the Examples Leading Similar to lag, this method leads the Examples Size methods Return the number of columns of Examples Size methods Return the number of columns of Examples Size methods Size methods Return the number of rows of Examples Column Rename Column Rename Rolling Functions Apply function The Examples Rolling Functions Apply function The Examples Subsetting based on Index Create a subset of Examples Subsetting based on Index Create a subset of Examples Tail Returns the last Tail Returns the last Frequency conversion Set of convenience methods for frequency conversion of Frequency conversion Set of convenience methods for frequency conversion of TSFrames.TSFrame
— Typestruct TSFrame
+ 0.108871 0.108871
TSFrames.TSFrame
— Typestruct TSFrame
coredata :: DataFrame
end
::TSFrame
- A type to hold ordered data with an index.DataFrame
with a specific column marked as an index. The input DataFrame
is sorted during construction and is stored under the property coredata
. The index is stored in the Index
column of coredata
.DataFrame
, Vector
, and 2-dimensional Array
. If an index is already not present in the constructor then a sequential integer index is created automatically.TSFrame(coredata::DataFrame)
: Here, the constructor looks for a column named Index
in coredata
as the index column, if this is not found then the first column of coredata
is made the index by default. If coredata
only has a single column then a new sequential index is generated.TSFrame.coredata
is a DataFrame it can be operated upon independently using methods provided by the DataFrames package (ex. transform
, combine
, etc.).TSFrame(coredata::DataFrame, index::Union{String, Symbol, Int}; issorted = false, copycols = true)
TSFrame(coredata::DataFrame, index::AbstractVector{T}; issorted = false, copycols = true) where {T<:Union{Int, TimeType}}
@@ -304,18 +304,18 @@
julia> ts = TSFrame(Date, [(Int64, "col1"), (String, "col2"), (Float64, "col3")]) # using strings instead of symbols
0×3 TSFrame with Date Index
-
Base.:==
— MethodTwo TSFrame are considered equal if their `coredata` property is equal.
+
Base.:==
— MethodTwo TSFrame are considered equal if their `coredata` property is equal.
Base.:(==)(tsf1::TSFrame, tsf2::TSFrame)::Bool
-Base.isequal(tsf1::TSFrame, tsf2::TSFrame)::Bool
Base.first
— Methodfirst(ts::TSFrame)
ts
as a TSFrame object.julia> first(TSFrame(1:10))
+Base.isequal(tsf1::TSFrame, tsf2::TSFrame)::Bool
Base.first
— Methodfirst(ts::TSFrame)
ts
as a TSFrame object.julia> first(TSFrame(1:10))
(10 x 1) TSFrame with Dates.Date Index
Index x1
Date Float64
───────────────────────
2022-02-01 0.768448
-
Base.iterate
— FunctionBase.iterate(tsf::TSFrame)
+
Base.iterate
— FunctionBase.iterate(tsf::TSFrame)
-Returns a row-based iterator for `tsf`.
Base.join
— Methodjoin(ts1::TSFrame, ts2::TSFrame, ts...; jointype::Symbol=:JoinAll)
TSFrame
objects can be combined together column-wise using Index
as the column key. There are four kinds of column-binding operations possible as of now. Each join operation works by performing a Set operation on the Index
column and then merging the datasets based on the output from the Set operation. Each operation changes column names in the final object automatically if the operation encounters duplicate column names amongst the TSFrame objects.join(ts1::TSFrame, ts2::TSFrame; jointype=:JoinInner)
and join(ts1::TSFrame, ts2::TSFrame; jointype=:JoinBoth)
ts1
and ts2
, and then merges the columns of both the objects. The resulting object will only contain rows which are present in both the objects' indexes. The function will rename columns in the final object if they had same names in the TSFrame objects.join(ts1::TSFrame, ts2::TSFrame; jointype=:JoinOuter)
and join(ts1::TSFrame, ts2::TSFrame; jointype=:JoinAll)
:ts1
and ts2
before merging the other columns of input objects. The output will contain rows which are present in all the input objects while inserting missing
values where a row was not present in any of the objects. This is the default behaviour if no jointype
is provided.join(ts1::TSFrame, ts2::TSFrame; jointype=:JoinLeft)
:ts1
and finds matching index values in the right object ts2
. The resulting object includes all the rows from the left object, the column values from the left object, and the values associated with matching index rows on the right. The operation inserts missing
values where in the unmatched rows of the right object.join(ts1::TSFrame, ts2::TSFrame; jointype=:JoinRight)
missing
values in rows missing from the left object.jointype=:JoinAll
if no jointype
is provided to the join
method.TSFrame
s is also supported. The syntax isjoin(ts1::TSFrame, ts2::TSFrame, ts...; jointype::Symbol)
jointype
must be one of :JoinInner
, :JoinBoth
, :JoinOuter
, :JoinAll
, :JoinLeft
or :JoinRight
. Note that join
on multiple TSFrame
s is left associative.cbind
is an alias for join
method.julia> using Random;
+Returns a row-based iterator for `tsf`.
Base.join
— Methodjoin(ts1::TSFrame, ts2::TSFrame, ts...; jointype::Symbol=:JoinAll)
TSFrame
objects can be combined together column-wise using Index
as the column key. There are four kinds of column-binding operations possible as of now. Each join operation works by performing a Set operation on the Index
column and then merging the datasets based on the output from the Set operation. Each operation changes column names in the final object automatically if the operation encounters duplicate column names amongst the TSFrame objects.join(ts1::TSFrame, ts2::TSFrame; jointype=:JoinInner)
and join(ts1::TSFrame, ts2::TSFrame; jointype=:JoinBoth)
ts1
and ts2
, and then merges the columns of both the objects. The resulting object will only contain rows which are present in both the objects' indexes. The function will rename columns in the final object if they had same names in the TSFrame objects.join(ts1::TSFrame, ts2::TSFrame; jointype=:JoinOuter)
and join(ts1::TSFrame, ts2::TSFrame; jointype=:JoinAll)
:ts1
and ts2
before merging the other columns of input objects. The output will contain rows which are present in all the input objects while inserting missing
values where a row was not present in any of the objects. This is the default behaviour if no jointype
is provided.join(ts1::TSFrame, ts2::TSFrame; jointype=:JoinLeft)
:ts1
and finds matching index values in the right object ts2
. The resulting object includes all the rows from the left object, the column values from the left object, and the values associated with matching index rows on the right. The operation inserts missing
values where in the unmatched rows of the right object.join(ts1::TSFrame, ts2::TSFrame; jointype=:JoinRight)
missing
values in rows missing from the left object.jointype=:JoinAll
if no jointype
is provided to the join
method.TSFrame
s is also supported. The syntax isjoin(ts1::TSFrame, ts2::TSFrame, ts...; jointype::Symbol)
jointype
must be one of :JoinInner
, :JoinBoth
, :JoinOuter
, :JoinAll
, :JoinLeft
or :JoinRight
. Note that join
on multiple TSFrame
s is left associative.cbind
is an alias for join
method.julia> using Random;
julia> random(x) = rand(MersenneTwister(123), x);
@@ -527,8 +527,8 @@
2017-01-08 0.0521332 0.0521332 0.0521332
2017-01-09 0.26864 0.26864 0.26864
2017-01-10 0.108871 0.108871 0.108871
-
Base.size
— Methodsize(ts::TSFrame)
ts
as a tuple.julia> TSFrames.size(TSFrame([collect(1:100) collect(1:100) collect(1:100)]))
-(100, 3)
Base.vcat
— Methodvcat(ts1::TSFrame, ts2::TSFrame; colmerge::Symbol=:union)
ts2
to ts1
.colmerge
keyword argument specifies the column merge strategy. The value of colmerge
is directly passed to cols
argument of DataFrames.vcat
.DataFrames.vcat
supports four types of column-merge strategies::setequal
: only merge if both objects have same column names, use the order of columns in ts1
.:orderequal
: only merge if both objects have same column names and columns are in the same order.:intersect
: only merge the columns which are common to both objects, ignore the rest.:union
: merge even if columns differ, the resulting object has all the columns filled with missing
, if necessary.julia> using Random;
+
Base.size
— Methodsize(ts::TSFrame)
ts
as a tuple.julia> TSFrames.size(TSFrame([collect(1:100) collect(1:100) collect(1:100)]))
+(100, 3)
Base.vcat
— Methodvcat(ts1::TSFrame, ts2::TSFrame; colmerge::Symbol=:union)
ts2
to ts1
.colmerge
keyword argument specifies the column merge strategy. The value of colmerge
is directly passed to cols
argument of DataFrames.vcat
.DataFrames.vcat
supports four types of column-merge strategies::setequal
: only merge if both objects have same column names, use the order of columns in ts1
.:orderequal
: only merge if both objects have same column names and columns are in the same order.:intersect
: only merge the columns which are common to both objects, ignore the rest.:union
: merge even if columns differ, the resulting object has all the columns filled with missing
, if necessary.julia> using Random;
julia> random(x) = rand(MersenneTwister(123), x);
@@ -655,7 +655,7 @@
2017-01-28 0.278259
2017-01-29 0.0231765
2017-01-30 0.516704
-
RecipesBase.apply_recipe
— Functionplot(ts::TSFrame, cols::Vector{Int} = collect(1:TSFrames.ncol(ts)))
+
RecipesBase.apply_recipe
— Functionplot(ts::TSFrame, cols::Vector{Int} = collect(1:TSFrames.ncol(ts)))
plot(ts::TSFrame, cols::Vector{T}) where {T<:Union{String, Symbol}}
plot(ts::TSFrame, cols::T) where {T<:Union{Int, String, Symbol}}
cols
on the y-axis. By default, plot all the columns. Columns can be selected using Int indexes, String(s), or Symbol(s).julia> using Random;
julia> random(x) = rand(MersenneTwister(123), x);
@@ -695,7 +695,7 @@
julia> # plot(ts[1:6], [:val1, :val3]);
# plot columns 1 and 2 on a specified window size
-julia> # plot(ts, [1, 2], size=(600, 400));
TSFrames._check_consistency
— MethodTSFrames.apply
— Methodapply(ts::TSFrame,
+julia> # plot(ts, [1, 2], size=(600, 400));
TSFrames._check_consistency
— MethodTSFrames.apply
— Methodapply(ts::TSFrame,
period::T,
fun::V,
index_at::Function=first;
@@ -797,7 +797,7 @@
2017-02-19 0.319216
2017-02-26 0.272058
2017-03-05 0.23651
-
TSFrames.describe
— Methoddescribe(ts::TSFrame; cols=:)
+
TSFrames.describe
— Methoddescribe(ts::TSFrame; cols=:)
describe(ts::TSFrame, stats::Union{Symbol, Pair}...; cols=:)
ts
. The output is a DataFrame
containing standard statistics along with number of missing values and data types of columns. The cols
keyword controls which subset of columns from ts
to be selected. The stats
keyword is used to control which summary statistics are to be printed. For more information about these keywords, check out the corresponding documentation from DataFrames.jl.julia> using Random;
julia> random(x) = rand(MersenneTwister(123), x...);
julia> ts = TSFrame(random(([1, 2, 3, 4, missing], 10)))
@@ -833,7 +833,7 @@
│ Symbol Int64 Int64
─────┼────────────────────────
1 │ x1 2 22
-
TSFrames.endpoints
— Functionendpoints(timestamps::AbstractVector{T}, on::V) where {T<:Union{Date, DateTime, Time},
+
TSFrames.endpoints
— Functionendpoints(timestamps::AbstractVector{T}, on::V) where {T<:Union{Date, DateTime, Time},
V<:Union{
Year,
Quarter,
@@ -1079,7 +1079,7 @@
2022-10-08T11:56:46
2022-10-08T12:32:08
2022-10-08T13:59:08
- 2022-10-08T14:37:17
TSFrames.head
— Functionhead(ts::TSFrame, n::Int = 10)
n
rows of ts
.julia> head(TSFrame(1:100))
+ 2022-10-08T14:37:17
TSFrames.head
— Functionhead(ts::TSFrame, n::Int = 10)
n
rows of ts
.julia> head(TSFrame(1:100))
(10 x 1) TSFrame with Int64 Index
Index x1
@@ -1094,7 +1094,7 @@
7 7
8 8
9 9
- 10 10
TSFrames.index
— Methodindex(ts::TSFrame)
coredata
DataFrame.julia> using Random;
+ 10 10
TSFrames.index
— Methodindex(ts::TSFrame)
coredata
DataFrame.julia> using Random;
julia> random(x) = rand(MersenneTwister(123), x);
@@ -1132,7 +1132,7 @@
2022-11-01
julia> eltype(index(ts))
-Date
TSFrames.isregular
— Methodisregular(timestamps::V, unit::T) where {V<:AbstractVector{TimeType}, T<:Dates.Period}
+Date
TSFrames.isregular
— Methodisregular(timestamps::V, unit::T) where {V<:AbstractVector{TimeType}, T<:Dates.Period}
isregular(timestamps::T) where {T<:AbstractVector{TimeType}}
isregular(timestamps::AbstractVector{V}, unit::Symbol = :firstdiff) where {V<:TimeType}
isregular(ts::TSFrame, unit::Symbol = :firstdiff)
@@ -1190,7 +1190,7 @@
false
julia> isregular(ts, :month)
-false
TSFrames.lag
— Functionlag(ts::TSFrame, lag_value::Int = 1)
ts
object by the specified lag_value
. The rows corresponding to lagged values will be rendered as missing
. Negative values of lag are also accepted (see TSFrames.lead
).julia> using Random, Statistics;
+false
TSFrames.lag
— Functionlag(ts::TSFrame, lag_value::Int = 1)
ts
object by the specified lag_value
. The rows corresponding to lagged values will be rendered as missing
. Negative values of lag are also accepted (see TSFrames.lead
).julia> using Random, Statistics;
julia> random(x) = rand(MersenneTwister(123), x);
@@ -1248,7 +1248,7 @@
2017-01-08 0.662555
2017-01-09 0.586022
2017-01-10 0.0521332
-
TSFrames.lead
— Functionlead(ts::TSFrame, lead_value::Int = 1)
ts
object by lead_value
. The lead rows are inserted with missing
. Negative values of lead are also accepted (see TSFrames.lag
).julia> using Random, Statistics;
+
TSFrames.lead
— Functionlead(ts::TSFrame, lead_value::Int = 1)
ts
object by lead_value
. The lead rows are inserted with missing
. Negative values of lead are also accepted (see TSFrames.lag
).julia> using Random, Statistics;
julia> random(x) = rand(MersenneTwister(123), x);
@@ -1314,7 +1314,7 @@
2017-01-08 0.108871
2017-01-09 0.163666
2017-01-10 0.473017
-
TSFrames.ncol
— Methodncol(ts::TSFrame)
ts
. nc
is an alias for ncol
.julia> using Random;
+
TSFrames.ncol
— Methodncol(ts::TSFrame)
ts
. nc
is an alias for ncol
.julia> using Random;
julia> random(x) = rand(MersenneTwister(123), x);
@@ -1322,10 +1322,10 @@
3
julia> nc(TSFrame([random(100) random(100) random(100)]))
-3
TSFrames.nrow
— Methodnrow(ts::TSFrame)
+3
TSFrames.nrow
— Methodnrow(ts::TSFrame)
nr(ts::TSFrame)
ts
. nr
is an alias for nrow
.julia> ts = TSFrame(collect(1:10))
julia> TSFrames.nrow(ts)
-10
TSFrames.rename!
— Methodrename!(ts::TSFrame, colnames::AbstractVector{String}; makeunique::Bool=false)
+10
TSFrames.rename!
— Methodrename!(ts::TSFrame, colnames::AbstractVector{String}; makeunique::Bool=false)
rename!(ts::TSFrame, colnames::AbstractVector{Symbol}; makeunique::Bool=false)
rename!(ts::TSFrame, (from => to)::Pair...)
rename!(ts::TSFrame, d::AbstractDict)
@@ -1441,7 +1441,7 @@
2012-01-08 8 18
2012-01-09 9 19
2012-01-10 10 20
-
TSFrames.rollapply
— Methodrollapply(ts::TSFrame, fun::Function, windowsize::Int; bycolumn=true)
fun
to rolling windows of ts
. The output is a TSFrame
object with (nrow(ts) - windowsize + 1)
rows indexed with the last index value of each window.bycolumn
argument should be set to true
(default) if fun
is to be applied to each column separately, and to false
if fun
takes a whole TSFrame
as an input.julia> rollapply(TSFrame([1:10 11:20]), mean, 5)
+
TSFrames.rollapply
— Methodrollapply(ts::TSFrame, fun::Function, windowsize::Int; bycolumn=true)
fun
to rolling windows of ts
. The output is a TSFrame
object with (nrow(ts) - windowsize + 1)
rows indexed with the last index value of each window.bycolumn
argument should be set to true
(default) if fun
is to be applied to each column separately, and to false
if fun
takes a whole TSFrame
as an input.julia> rollapply(TSFrame([1:10 11:20]), mean, 5)
6×2 TSFrame with Int64 Index
Index rolling_x1_mean rolling_x2_mean
Int64 Float64 Float64
@@ -1488,7 +1488,7 @@
2001-01-07 ([1.0], 4.86475e-16)
2001-01-08 ([1.0], 7.43103e-16)
2001-01-09 ([1.0], 7.45753e-15)
- 2001-01-10 ([1.0], 9.28561e-15)
TSFrames.subset
— Methodsubset(ts::TSFrame, from::T, to::T) where {T<:Union{Int, TimeType}}
ts
based on the Index
starting from
(inclusive) till to
(inclusive).julia> using Random;
+ 2001-01-10 ([1.0], 9.28561e-15)
TSFrames.subset
— Methodsubset(ts::TSFrame, from::T, to::T) where {T<:Union{Int, TimeType}}
ts
based on the Index
starting from
(inclusive) till to
(inclusive).julia> using Random;
julia> random(x) = rand(MersenneTwister(123), x);
julia> dates = Date("2022-02-01"):Week(1):Date("2022-02-01")+Month(9);
julia> ts = TSFrame(random(length(dates)), dates)
@@ -1612,7 +1612,7 @@
2022-10-25 0.621379
2022-11-01 0.348173
-
TSFrames.tail
— Functiontail(ts::TSFrame, n::Int = 10)
n
rows of ts
.julia> tail(TSFrame(1:100))
+
TSFrames.tail
— Functiontail(ts::TSFrame, n::Int = 10)
n
rows of ts
.julia> tail(TSFrame(1:100))
(10 x 1) TSFrame with Int64 Index
Index x1
@@ -1627,7 +1627,7 @@
97 97
98 98
99 99
- 100 100
TSFrames.to_period
— MethodTimeType
index types. Internally, they call endpoints()
to do the actual conversion. n
is the number of periods of the period
type. For example, to_monthly(tsf, 2)
will resample the time series to "every 2 months".to_period(tsf::TSFrame, period::T)::TSFrame where {T<:Period}
+ 100 100
TSFrames.to_period
— MethodTimeType
index types. Internally, they call endpoints()
to do the actual conversion. n
is the number of periods of the period
type. For example, to_monthly(tsf, 2)
will resample the time series to "every 2 months".to_period(tsf::TSFrame, period::T)::TSFrame where {T<:Period}
to_yearly(tsf::TSFrame, n=1)::TSFrame
to_quarterly(tsf::TSFrame, n=1)::TSFrame
to_monthly(tsf::TSFrame, n=1)::TSFrame
@@ -1638,4 +1638,4 @@
to_seconds(tsf::TSFrame, n=1)::TSFrame
to_milliseconds(tsf::TSFrame, n=1)::TSFrame
to_microseconds(tsf::TSFrame, n=1)::TSFrame
-to_nanoseconds(tsf::TSFrame, n=1)::TSFrame
Settings
This document was generated with Documenter.jl version 0.27.25 on Wednesday 20 March 2024. Using Julia version 1.10.2.