xKDR / TSFrames.jl

Timeseries in Julia
MIT License
91 stars 22 forks source link

Column indexing #116

Closed femtotrader closed 1 year ago

femtotrader commented 1 year ago

Hello,

Currently column indexing doesn't seems to work (at least not like I was expecting)

julia> using TimeFrames, MarketData;
julia> ts=TimeFrame(MarketData.yahoo(:AAPL))
julia> ts[!, :Close]
ERROR: MethodError: no method matching getindex(::TimeFrame, ::typeof(!), ::Symbol)
Closest candidates are:
  getindex(::TimeFrame, ::UnitRange, ::Union{String, Symbol}) at C:\Users\femto\.julia\packages\TimeFrames\mMgMC\src\getindex.jl:374
  getindex(::TimeFrame, ::T, ::Union{String, Symbol}) where T<:TimeType at C:\Users\femto\.julia\packages\TimeFrames\mMgMC\src\getindex.jl:277
  getindex(::TimeFrame, ::AbstractVector{Int64}, ::Union{String, Symbol}) at C:\Users\femto\.julia\packages\TimeFrames\mMgMC\src\getindex.jl:314
  ...
Stacktrace:
 [1] top-level scope
   @ REPL[26]:1

It seems that

TimeFrame(ts.coredata[!, [:Index, :Close]])

is a workaround

Selecting several columns should also be considered like this

ts[!, [:Open, :Close]]

Kind regards

femtotrader commented 1 year ago
 ts[:, [:Close]]

and

 ts[:, [:Open, :Close]]

does column indexing. Sorry for noise. Maybe it should be added to doc.

chiraganand commented 1 year ago
 ts[:, [:Close]]

and

 ts[:, [:Open, :Close]]

does column indexing. Sorry for noise. Maybe it should be added to doc.

For some reason getindex() documentation isn't getting generated. Will check this.

chiraganand commented 1 year ago

For some reason getindex() documentation isn't getting generated. Will check this.

Removed some unnecessary code from the top of src/getindex.jl which I thought could be causing this but the issue remains. @codetalker7 @ayushpatnaikgit Any idea what could be causing getindex.jl documentation to get excluded by Documenter?