This code snippet shows you how to union two pandas DataFrames in python using concat
method in pandas namespace.If the schema is different, pandas will autmatically merge it.
Output
category value user
0 A 0 2.0
1 B 1 3.0
2 C 2 2.0
3 D 3 1.0
4 E 4 1.0
0 A 0 NaN
1 B 1 NaN
2 C 2 NaN
3 D 3 NaN
4 E 4 NaN
For the second DataFrame, column user doesn't exist. Pandas uses NaN
to mark it.