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