Transform DataFrame into a single row by adding row contents as new columns

I would like to convert

df = DataFrame(A=['x','y','z','t'], B=[1,2,3,4])
4×2 DataFrame
 Row │ A     B
     │ Char  Int64
─────┼─────────────
   1 │ x         1
   2 │ y         2
   3 │ z         3
   4 │ t         4

to

8×1 DataFrame
 Row │ F1     F2      F3      F4      F5      F6       F7      F8
     │ Char   Int64   Char    Int64   Char    Int64
─────┼─────────────────────────────────────────────────────────────
   1 │ x      1       y       2       z       3        t       4

Is there a simple way to apply this transformation?

julia> DataFrame(reshape(permutedims([df[:, 1] df[:, 2]]), 1, 8))

1×8 DataFrame
│ Row │ x1  │ x2  │ x3  │ x4  │ x5  │ x6  │ x7  │ x8  │
│     │ Any │ Any │ Any │ Any │ Any │ Any │ Any │ Any │
├─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
│ 1   │ 'x' │ 1   │ 'y' │ 2   │ 'z' │ 3   │ 't' │ 4   │
1 Like

I would do something like this:

julia> hcat((eachrow(df) .|> DataFrame)..., makeunique=true)

 Row │ A     B      A_1   B_1    A_2   B_2    A_3   B_3   
     │ Char  Int64  Char  Int64  Char  Int64  Char  Int64 
─────┼────────────────────────────────────────────────────
   1 │ x         1  y         2  z         3  t         4
1 Like

I did this (Julia 1.6.1):

DataFrame(reshape(permutedims([df[:, 1] df[:, 2]]), 1, 8), :auto)
1 Like