PairAsPipe.jl

Author xiaodaigh
Popularity
0 Stars
Updated Last
2 Years Ago
Started In
September 2020

This has been deprecated in favour of PairsMacros.jl

PairAsPipe.jl

PairAsPipe (@pap) is friendly with DataFrames.jl's API.

The macro @pap is designed to transform newcol = fn(:col) to :col => fn => :newcol which is an elegant (ab)use of pairs syntax (a => b) as pipes. Hence the name of the package.

Usage

Some examples

using DataFrames, PairAsPipe

df = DataFrame(a = 1:3)

transform(df, @pap b = :a .* 2) # same as transform(df, :a => a->a.*2 => :b)

transform(df, @pap :a .* 2) # same as transform(df, :a => a->a.*2); except for output column name

transform(df, @pap sum(:a)) # same as transform(df, :a => mean); except for output column name

filter(@pap(:a == 1), df) # same as filter([:a] => a -> a == 1, df)

Similar Work

Required Packages

Used By Packages

No packages found.