DataFramesMeta questions

I use @aside all the time. Its a fantastic tool.
Sorry, that code was a bad illustration of the point.

I’m just saying, imagine if things chained automatically without writing the @chain macro

One feature I would like to see is a @chain macro which operates in global scope. Something like

@chain df @global begin 

this would make it easier to debug. This would be a relatively simple PR.

So writing X = _ within the chain, would be like writing global X = _
That would be really good.

would it be possible to allow more flexibility in @rtransfrom ?
Allow statements like

               :x += 1


              :y, :z   = :x , :x

Probably not at the moment. It’s hard to map that to a src => fun => dest expression in DataFrames that gets sent to transform.

:x => x->x+1 => :x and :x => identity => :y, x:=>identity => :z ?

Yeah. That’s feasible.

I just mean that it would take some work to special-case those exact syntaxes (and open the door to new ones). Please make a PR if interested!

@chain begin
    DataFrame(  A=1,   B=2  )
    @rtransform  :X = (; :A , :B)  

:X = (##1262 = 1, ##1263 = 2)

But I’d like the column names to become the tuple names
:X = (A=1, B=2)

Is this possible?

Did you try :x = (a=:a, b=:b)?

That works but I have 20 columns. I don’t want to list them all twice

Perhaps write a function that generates the needed code and

@rtransform :x = $(tupelifycols(df))

This function already exists: it’s Tables.rowtable.


Many thanks:)

Yes, this is known, and comes from the way DataFramesMeta’s function creation works. Can you please file an issue so I can keep track of it?

That works but I have 20 columns. I don’t want to list them all twice

Maybe the new @astable macro-flag can help here? Maybe not, though, if you want :x to be a vector of named tuples.


1 Like