Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Append rows just beneath an excel using Pandas

First data frame is:

a b c
1 2 3

Second data frame is:

a1 b c1
4 5 6

What I expect is:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

a b c
1 2 3
4 5 6

Just move all values from df2 in df1, the column names may be different.

>Solution :

One option is to concatenate the underlying numpy arrays and build a DataFrame:

out = pd.DataFrame(np.r_[df1.to_numpy(), df2.to_numpy()], columns=df1.columns)

Output:

   a  b  c
0  1  2  3
1  4  5  6
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading