I have two excel files, the first one has 34 columns and the second one has 19 columns, the first one has all these 19 columns but if I add some empty column I can get the structure of the first file. I want to append rows from 2nd file to the first file
I added empty columns to get the same structure as the first one but when I tried to merge both data frames I got: ValueError: Plan shapes are not aligned (maybe because of those empty columns doesn't have a name )
merged = pd.read_excel(r'D:\Incident in detail.xlsx')
resolved = pd.read_excel(r'D:\Data set\Resolved Incident.xlsx')
for i in range(13,26):
resolved.insert(i,"","",allow_duplicates=True)
resolved.insert(33,"","", allow_duplicates=True)
resolved_planning = resolved[resolved['Priority'] == '5 - Planning']
merged.append(resolved_planning, ignore_index = True, sort = False)
merged.to_excel(r'D:\test.xlsx', index = False)
I also tried using itertuples() but didn't get anything on how to append a list as a row into a data frame.
Edit1:
There is a library dplyr in R in which there is a method bind_rows() which can append rows by column name example