A Dataframe has axes (indices) -- Row index (axis=0) --Column index (axes=1).
Pandas provides various facilities for easily combining together Series, DataFrame.
pd.concat(objs, axis=0, join='outer', join_axes=None,ignore_index=False)
• objs − This is a sequence or mapping of Series, DataFrame, or Panel objects.
• axis − {0, 1, ...}, default 0. This is the axis to concatenate along.
• join − {‘inner’, ‘outer’}, default ‘outer’. How to handle indexes on other axis(es). Outer for union and inner for the intersection.
• ignore_index − boolean, default False. If True, do not use the index values on the concatenation axis. The resulting axis will be labeled 0, ..., n - 1.
• join_axes − This is the list of Index objects. Specific indexes to use for the other (n-1) axes instead of performing inner/outer set logic.
con = pd.concat([df1, df2]) # If column names are the same.
con = pd.concat([df1, df2], axis="columns")
If indices are the same between datasets. If they’re different, by default the extra indices (rows) will also be added, and NaN values will be filled.
Two DataFrames might hold different kinds of information about the same entity and are linked by some common feature/column. To join these DataFrames, pandas provides multiple functions like merge(), join() etc.
If you have an SQL background, then you may use the merge operation names from the JOIN syntax. You can use Full Outer Join, Inner Join, RightJoin, Left Join,Joining on Index.