I have multiple dataframes and I want to get the result_df by concatenating multiple dataframes. Any suggestions on this?
I am using following code but I am not getting error: Error tokenizing data. C error: Expected 1 fields in line 4, saw 5
list_ = [] if os.path.exists(csvfile): df = pd.read_csv(csvfile, sep=',', encoding='utf-8') list_.append(pd.concat(df)) frame = pd.concat(list_,ignore_index=True) df1 = Apple Banana 0 1 7 1 2 10 2 4 5 3 5 1 4 7 5 df2 = Apple Banana Carrot 0 1 7 5 1 2 10 8 2 4 5 8 3 5 1 2 4 7 5 1 df3 = Apple Carrot Mango 0 1 5 2 1 2 8 3 2 4 8 7 3 5 2 1 4 7 1 5 result_df = Apple Banana Carrot Mango 0 1 7 n.a n.a 1 2 10 n.a n.a 2 4 5 n.a n.a 3 5 1 n.a n.a 4 7 5 n.a n.a 5 1 7 5 n.a 6 2 10 8 n.a 7 4 5 8 n.a 8 5 1 2 n.a 9 7 5 1 n.a 10 1 n.a 5 2 11 2 n.a 8 3 12 4 n.a 8 7 13 5 n.a 2 1 14 7 n.a 1 5