Skip to content

Commit

Permalink
Try switching back to deepcopy instead of copy
Browse files Browse the repository at this point in the history
  • Loading branch information
asinghvi17 committed Feb 16, 2023
1 parent 30315fa commit 37da40b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/TSFrame.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 37da40b

Please sign in to comment.