Let’s say I a have a DataFrame with a column :C1
. The elements of the column are structs of the type
struct MyStruct
a::Float64
b::Float64
end
How do I extract, for example, the field :a
from the elements of the column :C1
into a separate column?
I am trying to do it with the following command:
new_df = @linq df |> transform(a = getfield.(:C1, :a))
However, it seems, that getfield
is dispatched on the whole column :C1
instead of the elements of this column, so the command does not work.
Does anyone have the ideas how to fix the wrong dispatch? May be I should use some other approach?