I have two df's like below,
df1
│ Row │ x1 │ x2 │ x3 │
│ │ Int64 │ Int64 │ Int64 │
├─────┼───────┼───────┼───────┤
│ 1 │ 8 │ 1 │ 4 │
│ 2 │ 4 │ 3 │ 1 │
│ 3 │ 7 │ 8 │ 1 │
df2
│ Row │ x1 │ x2 │ x3 │ x4 │
│ │ Int64 │ Int64 │ Int64 │ Int64 │
├─────┼───────┼───────┼───────┼───────┤
│ 1 │ 20 │ 14 │ 18 │ 100 │
│ 2 │ 13 │ 19 │ 17 │ 101 │
│ 3 │ 13 │ 10 │ 16 │ 102 │
When I perform vcat it throws, ArgumentError: column(s) x4 are missing from argument(s) 1
I understood this error because of mismatched column names. Is there any way I can still append these dataframes and put missing
wherever it's not found.
Expected output:
6×3 DataFrame
│ Row │ x1 │ x2 │ x3 │ x4 |
│ │ Int64 │ Int64 │ Int64 │ |
├─────┼───────┼───────┼───────┤───────┤
│ 1 │ 8 │ 1 │ 4 │missing|
│ 2 │ 4 │ 3 │ 1 │missing|
│ 3 │ 7 │ 8 │ 1 │missing|
│ 4 │ 20 │ 14 │ 18 │100 |
│ 5 │ 13 │ 19 │ 17 │101 |
│ 6 │ 13 │ 10 │ 16 │102 |