From f5a84269b1a0d9d772cc0e22e4008027cf650807 Mon Sep 17 00:00:00 2001 From: Andrey Oskin Date: Thu, 8 Apr 2021 13:55:52 +0300 Subject: [PATCH] fixed small timetables bugs --- Project.toml | 2 +- src/tables.jl | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Project.toml b/Project.toml index 55bb44e..95dac4d 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Timestamps" uuid = "0123453a-27b6-4e80-93fe-c2c00e33fefb" authors = ["Andrey Oskin and contributors "] -version = "0.1.1" +version = "0.1.2" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" diff --git a/src/tables.jl b/src/tables.jl index 6596082..f9aca18 100644 --- a/src/tables.jl +++ b/src/tables.jl @@ -51,6 +51,9 @@ Tables.getcolumn(mci::TimestampArrayTableColsIterator, nm::Symbol) = Tables.getc # Ok, this one is experimental and probably should be moved to a different package istimetable(::T) where T = istimetable(T) istimetable(::Type{T}) where T = false +timeaxis(::T) where T = timeaxis(T) +timeaxis(::Type{T}) where T = :timestamp + istimetable(::Type{<:TimestampArray}) = true timeaxis(x::TimestampArray) = :timestamp @@ -66,9 +69,9 @@ function TimestampArray(x; timestamp = :timestamp) end rows = Tables.rows(x) tsps = map(rows) do row - rt = ntuple(i -> row[indx[i]], length(row) - 1) - Timestamp(getproperty(row, tscol), rt) + rt = ntuple(i -> Tables.getcolumn(row, indx[i]), length(row) - 1) + Timestamp(Tables.getcolumn(row, tscol), rt) end - return TimestampArray(tsps, names[indx]) + return TimestampArray(tsps, collect(names[indx])) end