I have two dataframes that look like this:
df1= A B 1 A1 B1 2 A2 B2 3 A3 B3 df2 = A C 4 A4 C4 5 A5 C5 I would like to append df2 to df1, like so:
A B 1 A1 B1 2 A2 B2 3 A3 B3 4 A4 NaN 5 A5 NaN (Note: I've edited the dataframes so that not all the columns in df1 are necessarily in df2)
Whether I use concat or append, the resulting dataframe I get would have a column called "C" with the first three rows filled with nan. I just want to keep the two original columns in df1, with the new values appended. Is there a way concatenate the dataframes without having to drop the extra column afterwards?