Hi, Julian wizard people.
I want to rewrite the data in the DataFrames column.
It works fine for now, but I don’t like this writing method because it’s not smart.
The same description is repeated.
Is there a simpler, smarter way to describe it?
df = DataFrame(COL01 = [1,2,3,4,5])
return args * 100
# This is sample. Actual program is more long.
#It works, but it’s not cool.
df[(df.:COL01 .> 2),:COL01] = helper!.(df[(df.:COL01 .> 2),:COL01])
Is there a more expert way to do this?
Are you coming from Stata? This is a very stat-esque way of doing things.
A few notes
helper! function is oddly named. It doesn’t actually modify the thing it is acting on. This matters because you don’t actually need the assignment on the LHS
- This is definitely something DataFrames or helper packages could improve on. It’s on our radar here.
I don’t think there is a trivial solution, just intermediate variables
t = df.COL01
tsub = t[t .> 2]
tsub .= helper.(tsub)
Thank you very much for your kind reply.
I’m not Stata user.
I’m retired an older generation C/C++ programmer.
Please forget function name.
This is just a sample. It does not have a clear meaning.
I look forward to seeing your new roadmap.
And I will also try to be of some help.
Thanks a lot.