diff --git a/src/TSFrame.jl b/src/TSFrame.jl index 94a5426..fb18f96 100644 --- a/src/TSFrame.jl +++ b/src/TSFrame.jl @@ -330,7 +330,7 @@ struct TSFrame end - sorted_cd = issorted ? (copycols ? copy(coredata) : coredata) : sort(coredata, index) + sorted_cd = issorted ? (copycols ? deepcopy(coredata) : coredata) : sort(coredata, index) if (index isa Symbol && index == :Index) || (index isa String && index == "Index") return new(sorted_cd) @@ -345,9 +345,9 @@ struct TSFrame # From DataFrame, external index function TSFrame(coredata::DataFrame, index::AbstractVector{T}; issorted = false, copycols = true) where {T<:Union{Int, TimeType}} - sorted_index = issorted ? (copycols ? copy(index) : index) : sort(index) + sorted_index = issorted ? (copycols ? deepcopy(index) : index) : sort(index) - cd = copy(coredata) + cd = deepcopy(coredata) insertcols!(cd, 1, :Index => sorted_index, after=false, copycols = copycols) new(cd) @@ -378,7 +378,7 @@ end # From DataFrame, index range function TSFrame(coredata::DataFrame, index::UnitRange{Int}; issorted = false, copycols = true) index_vals = collect(index) - cd = copy(coredata) + cd = deepcopy(coredata) insertcols!(cd, 1, :Index => index_vals, after=false, copycols=copycols) TSFrame(cd, :Index; issorted = issorted, copycols = copycols) end