Git Product home page Git Product logo

series.jl's Introduction

Build Status

Series.jl

Installation

julia> Pkg.clone("https://github.com/milktrader/Series.jl")

Proposed Goal

Series is a simple, lightweight package that leverages Julia's Array methods to provide functionality important for working with serialized data. The primary mechanism to achieve this is the SeriesPair type, a tuple-like type with semantics that makes it easy to reason about serialized applications.

SeriesPair is immutable and includes two fields, index and value. When combined into an array, the resulting object becomes an Array{SeriesPair{T,V},1}, which enforces that each index in the array is the same type, and each value in the array is the same type.

Series is an intermediary tool for working with Arrays of base-defined types (e.g. Float64, Bool), and heterogeneous DataFrames. Conversion and promotion methods are planned to allow transition between the data structures.

To enforce the goal of simplicity, Series only supports single column values. Multiple columns can be attained by transitioning to an array of SeriesPair values, or to DataFrames.

API

julia> using Series

# generic index 

julia> foo = SeriesArray([1:3], 5.*[1:3.])
3-element Array{SeriesPair{Int64,Float64},1}:
 1  5.0
 2  10.0
 3  15.0

julia> bar = SeriesArray([2:4], 10.*[2:4.])
3-element Array{SeriesPair{Int64,Float64},1}:
 2  20.0
 3  30.0
 4  40.0

julia> Array(foo, bar)
4x2 Array{Float64,2}:
   5.0  NaN
  10.0   20.0
  15.0   30.0
 NaN     40.0

julia> ans |> removenan
2x2 Array{Float64,2}:
 10.0  20.0
 15.0  30.0

# using Datetime object as index

julia> op = readseries(Pkg.dir("Series/test/data/spx.csv"));

julia> cl = readseries(Pkg.dir("Series/test/data/spx.csv"), value=5);

julia> cl ./ op |> head
1-element Array{SeriesPair{Date{ISOCalendar},Float64},1}:
 1970-01-02  1.0102107321312188

julia> op |> percentchange |> removenan |> head
1-element Array{SeriesPair{Date{ISOCalendar},Float64},1}:
 1970-01-05  0.010210732131218946

julia> lag(cl)[1:2]
2-element Array{SeriesPair{Date{ISOCalendar},Float64},1}:
 1970-01-02  NaN
 1970-01-05  93.0

series.jl's People

Watchers

James Cloos avatar Rene Donner avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.