Concatenate a list of pandas dataframes together
Just to add few more details:
Example:
list1 = [df1, df2, df3]
import pandas as pd
Row-wise concatenation & ignoring indexes
pd.concat(list1, axis=0, ignore_index=True)
Note: If column names are not same then NaN would be inserted at different column values
Column-wise concatenation & want to keep column names
pd.concat(list1, axis=1, ignore_index=False)
If ignore_index=True, column names would be filled with numbers starting from 0 to (n-1), where n is the count of unique column names
Given that all the dataframes have the same columns, you can simply concat
them:
import pandas as pd
df = pd.concat(list_of_dataframes)
If the dataframes DO NOT all have the same columns try the following:
df = pd.DataFrame.from_dict(map(dict,df_list))