Announcing TSFrames.jl (formerly TSx) v0.1.0: A timeseries data manipulation package based on DataFrames

TSFrames provides a convenient interface for performing standard manipulations of timeseries data. The package uses DataFrame at it’s core to allow powerful data manipulation functions while being lightweight. A lot of functionality/interfaces are inspired by the zoo and xts packages in the R ecosystem.

TSFrames.jl is registered in the general Julia repository, hence, can be added using Pkg.add("TSFrames").

Repository URL: GitHub - xKDR/TSFrames.jl: Timeseries in Julia
Link to the documentation: Introduction · TSFrames.jl

15 Likes

Are you planning to use metadata to track Index in the future?

Are you planning to use metadata to track Index in the future?

Planning to use the DataFrames metadata for storing various table-level information like data source, year, and other such information.

1 Like

Worth adding a comparison with tons of other packages already available for time series in Julia.

Some of the design principles which were followed while building this package:

  1. Handling of heterogeneous data types: most existing packages handles one type in the core data structure.
  2. Easy maintenance: some main timeseries related packages are currently unmaintained.
  3. Avoiding duplication of coding effort by using the core data structure of an existing widely used and well-tested package (DataFrames.jl).
  4. Convenient syntax: most of the timeseries related data operations can be done using DataFrames but the syntax it isn’t really convenient or intuitive for such operations. The TSFrames interfaces are convenient for doing timeseries specific operations but under the hood most of them use DataFrames operations.
2 Likes

I am currently developing a finance related library and it is significantly dependent on TSFrames.jl as it looks to me that it is the only maintained time series data library.

I am just wondering if you will be maintaining this library in the future?

Thank you.

Can you send the link to your library? We (XKDR Forum) have also started work on some other finance-related packages which depend on TSFrames.jl. It would be good to know what each of us are doing to avoid overlap and collaborate, if possible.

Yes, we do plan to maintain the package going forward.

1 Like

Thanks very much for the answer. To be honest too early to share something. There are only a few functions at this moment but will grow over time.

It will start with very basic functions like simple returns, then will be portfolio returns, and risk metrices etc.

Whereever possible TSFrames functions will be used within functions to avoid unnecessary duplication and where not possible will be writing custom ones.

Regards

2 Likes

Do you know if OnlineStats.jl will “just work” with TSFrames?

-viral

1 Like

Just checked OnlineStats. Some of the methods which accept an array or <:Number as input just work by subsetting a TSFrame. Some others like Lag() which accept custom type are also able to store last N values of type TSFrame.

1 Like

Hi @chiraganand,

I was wondering if there is any way to calculate the percentiles of the TSFrame object.

using TSFrames
using Statistics

bond = [0.06276629, 0.03958098, 0.08456482,0.02759821,0.09584956,0.06363253,0.02874502,0.02707264,0.08776449,0.02950032]
stock = [0.1759782,0.20386651,0.21993588,0.3090001,0.17365969,0.10465274,0.07888138,0.13220847,0.28409742,0.14343067]

ts = TSFrame([bond stock])

I am looking for something like:

quantile(ts, 0.10)

to calculate the quantiles of column(s).

There is no method currently which dispatches on quantile() in TSFrames but you can use Tables.jl columns interface to iterate over columns:

Import Tables

q = []
for col in Tables.columns
    push!(q, quantile(col, 0.10))
end

Thank you for your answer. One another question, please:

skipmissing(ts)

skipmissing is not working, and I cannot remove the missing values from a TSFrame object. I checked the documentation but could not find a function to remove NAs or missing values.

Is there any way to do that?

Thank you

You might be looking for dropmissing .

Which version are you on? I am doing this on v0.2.0:

julia> skipmissing(TSFrame(1:10))
skipmissing(10×1 TSFrame with Int64 Index
 Index  x1    
 Int64  Int64 
──────────────
     1      1
     2      2
     3      3
     4      4
     5      5
     6      6
     7      7
     8      8
     9      9
    10     10)

Thanks very much for your reply. I see that this also works for me. Just that I was using it with another function, that’s why it has thrown an error.

My apologies for coming back on this again. Is there any way I can drop rows contain missing

Unfortunately, so many functions in Julia do not accept skipmissing(TSFrame(1:10)), and it throws a lot of errors because of it.

Thank you

Thanks for your reply @jar1, dropmissing does not work with TSFrame object.

skipmissing is for iterators directly, not a data frame-like object which do not iterate values themselves.

@bkamins Should dropmissing be generic in DataAPI? TSFrames is implementing skipmissing; I’m not sure that’s the right way to go.