I have data frame which has column say “minutes” and I need to create another data frame using “minutes” as columns as shown below.
I was able to create using reshape but values are being concatenated where I need them in vertical.
julia> df.values
89011-element Vector{Float64}:
122.50652071263562
122.72935583046971
122.95219094830381
123.180309439943
123.40987110571591
123.63943277148881
⋮
249.6565598272147
249.9075845099697
250.16789295401594
250.43361068950563
250.69932842499531
250.965046160485
julia> df = DataFrame(reshape(df.minutes, (nrow(df) ÷ 41, 41)), :auto)
2171×41 DataFrame
Row │ x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 ⋯ │ Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 Float64 ⋯──────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ 122.507 77.8383 95.3854 81.4284 131.8 57.1008 65.8545 84.5781 130.348 155.776 114.96 58.0395 165.353 192.448 129.974 139.679 77.458 ⋯ 2 │ 122.729 78.3159 95.8029 81.7817 132.142 57.2633 65.9749 84.7923 130.557 156.021 115.185 58.1356 165.709 192.901 130.176 139.793 77.5758
3 │ 122.952 238.488 96.2481 82.1657 132.5 57.4258 66.1241 85.0073 130.766 156.281 115.416 58.2317 166.072 193.387 130.38 139.906 77.6937
4 │ 123.18 238.834 96.7181 82.5991 132.858 57.5883 66.281 85.2519 130.976 156.542 115.646 58.3278 166.458 193.882 130.584 140.019 77.8115
⋮ │ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋱ 2168 │ 76.4467 93.8315 80.2422 130.655 56.6275 65.3732 83.7593 129.567 154.81 114.134 57.7004 164.007 190.775 129.211 139.227 76.9876 142.758 ⋯ 2169 │ 76.742 94.2027 80.514 130.872 56.7377 65.4935 83.9443 129.752 155.046 114.34 57.7839 164.336 191.168 129.401 139.34 77.1044 142.952
2170 │ 77.0497 94.5865 80.7859 131.137 56.8479 65.6139 84.1498 129.937 155.289 114.547 57.8673 164.666 191.582 129.592 139.453 77.2223 143.153
2171 │ 77.444 94.9704 81.0751 131.468 56.9581 65.7342 84.3639 130.138 155.533 114.753 57.9508 164.996 191.995 129.783 139.566 77.3401 143.355
As you can see above values are being created as
122.50652071263562 ==> 1st row
122.72935583046971 ==> 2nd row
122.95219094830381 ==> 3rd row
I need them in columns x1, x2, x3 …