Union and union all in Pandas dataframe Python:
Union all of two data frames in pandas can be easily achieved by using concat() function. Lets see with an example. First lets create two data frames
df1 will be
df2 will be
Union all of dataframes in pandas:
UNION ALL
concat() function in pandas creates the union of two dataframe.
union all of two dataframes df1 and df2 is created with duplicates. So the resultant dataframe will be
Union all of dataframes in pandas and reindex :
concat() function in pandas creates the union of two dataframe with ignore_index = True will reindex the dataframe
union all of two dataframes df1 and df2 is created with duplicates and the index is changed. So the resultant dataframe will be
Union of dataframes in pandas:
UNION