Cross join DataFrames

How can I cross join two dataframes A and B? In other words, combine every row in A with every row in B? I prefer not to do tricks like adding temporary columns.

use crossjoin:

  julia> df1 = DataFrame(X=1:3)
  3Ɨ1 DataFrame
   Row │ X
       │ Int64
  ─────┼───────
     1 │     1
     2 │     2
     3 │     3

  julia> df2 = DataFrame(Y=["a", "b"])
  2Ɨ1 DataFrame
   Row │ Y
       │ String
  ─────┼────────
     1 │ a
     2 │ b

  julia> crossjoin(df1, df2)
  6Ɨ2 DataFrame
   Row │ X      Y
       │ Int64  String
  ─────┼───────────────
     1 │     1  a
     2 │     1  b
     3 │     2  a
     4 │     2  b
     5 │     3  a
     6 │     3  b
3 Likes