5

Is there a way to access current_row_index in the following snippet ?

@with df begin
    fn.(:col, current_row_index)
end

1 Answer 1

5

In this context, since you are broacasting just pass first axes of df:

julia> using DataFramesMeta

julia> fn(x, y) = (x, y)
fn (generic function with 1 method)

julia> df = DataFrame(col=["a", "b", "c"])
3×1 DataFrame
 Row │ col
     │ String
─────┼────────
   1 │ a
   2 │ b
   3 │ c

julia> @with df begin
           fn.(:col, axes(df, 1))
       end
3-element Vector{Tuple{String, Int64}}:
 ("a", 1)
 ("b", 2)
 ("c", 3)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.