How to format data for an assignment problem

Hi, I’m new to Julia and programming and general . I’m working on an assigment problem and I’m having some trouble working with DataFrames. I’m trying to create a new dataframe that consist of 2 columns from another dataframe. One colum is going to transform into rows and the other one is going to be the columns of the new dataframe. Something similar to a pivot table on excel. Then I’d like to assign the quotient of 2 colums to the correspondant row, column set. What would be the best way to do this?
this picture might represent my idea better:

First you can do df2 = select(df, [:col1, :col2, :col5]) to get a dataframe with the three columns you want (just calculate the division column before doing the pivoting). Then you can use df3 = unstack(df2, :col1, :col2, :col5) which should lead to the pivoted version you wanted if I understood correctly.

1 Like