Pandas add dataframe to another row-wise by columns setting columns not available in the other as "nan"
Use pd.concat([A, B], axis=0, ignore_index=True)
Say we have two dataframes, A with columns a,b,c and B with columns a,b,d and some values
A =




a
b
c




1
2
3


4
5
6


7
8
9




and B =




a
b
d




1
2
3


4
5
6


7
8
9




Is there a pandas function with can combine the two so that
C = f(A,B) =




a
b
c
d




1
2
3
nan


4
5
6
nan


7
8
9
nan


1
2
nan
3


4
5
nan
6


7
8
nan
9




In other words, the columns that exist in one dataframe but not the other should be set to 'nan' in the other when adding the rows, but still add rows values on the columns common to both. I've tried join, concat and merge, but it seems that they don't work in this way, or I've used them wrong. Anyone have suggestions?