Hacker News new | ask | show | jobs
by stillyslalom 1240 days ago
Take a look at DataFramesMeta for nicer manipulation of Julia's dataframes. Your example would look like

  julia> df = DataFrame(y = rand(10^6), filter=randn(10^6));

  julia> @transform!(df, :x = cumsum(:y .* :filter))
  1000000×3 DataFrame
       Row │ y          filter      x
           │ Float64    Float64     Float64
  ─────────┼────────────────────────────────────
         1 │ 0.0726663   1.7213       0.125081
         2 │ 0.183898   -0.392131     0.0529686
         3 │ 0.150274    1.08083      0.21539
      ⋮    │     ⋮          ⋮            ⋮
It's particularly nice in conjunction with @chain [1].

[1] https://juliadata.github.io/DataFramesMeta.jl/dev/#Chaining-...