append two dataframe code example

Example 1: append to pandas dataframe

df = df.append({'index1': value1, 'index2':value2,...}, ignore_index=True)

Example 2: combine two dataframe in pandas

# Stack the DataFrames on top of each other
vertical_stack = pd.concat([survey_sub, survey_sub_last10], axis=0)

# Place the DataFrames side by side
horizontal_stack = pd.concat([survey_sub, survey_sub_last10], axis=1)

Example 3: how to merge two pandas dataframes on a column

import pandas as pd
T1 = pd.merge(T1, T2, on=T1.index, how='outer')

Example 4: merge two df

bigdata = pd.concat([data1, data2], ignore_index=True, sort=False)

Example 5: appending dataframes pandas

>>> df = pd.DataFrame([[1, 2], [3, 4]], columns=list('AB'))
>>> df
   A  B
0  1  2
1  3  4
>>> df2 = pd.DataFrame([[5, 6], [7, 8]], columns=list('AB'))
>>> df.append(df2)
   A  B
0  1  2
1  3  4
0  5  6
1  7  8