Hello!, I'm currently trying to merge a set of asset returns from a CSV file, we h

Hello!, I’m currently trying to merge a set of asset returns from a CSV file, we have two assets and I have got them into a dataframe along with the timestamp, as follows

Row │ timestamp   brka      brkb    
     │ Date        Float64   Float64 
─────┼───────────────────────────────
   1 │ 2009-12-31   99200.0  3286.0
   2 │ 2010-01-04   99600.0  3311.0
   3 │ 2010-01-05   99710.0  3327.0

i’m trying to run this piece of code diff(log.(asset[:, x])) where x is the column and put that data into another dataframe with the timestamps (there will be 1 less row in the new dataframe as there will be no theoretical difference between row 0 and row 1)

does anybody have any solutions as to my best approach here, i understand the maths, but i’ve been using julia like 3 days and dont know what it’s capable of

Note that the original poster on Slack cannot see your response here on Discourse. Consider transcribing the appropriate answer back to Slack, or pinging the poster here on Discourse so they can follow this thread.
(Original message :slack:) (More Info)

Solution Courtesy of Peter Deffebach

df = DataFrame()
nms = [:brka, :brkb]
for x in nms
    df[:, x] = diff(log.(asset[:, x]))
end
1 Like