Reputation: 103
Is there a way to access current_row_index in the following snippet ?
@with df begin
fn.(:col, current_row_index)
end
Upvotes: 5
Views: 70
Reputation: 69829
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)
Upvotes: 5