Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding values to end of pandas data frame from beginning of data frame [duplicate]

I have a pandas data frame that looks something like this:

  A B C
0 1 2 3
1 4 5 6
2 7 8 9

And I would like to add row 0 to the end of the data frame and to get a new data frame that looks like this:

  A B C
0 1 2 3
1 4 5 6
2 7 8 9
3 1 2 3

What can I do in pandas to do this?

like image 234
Bobby Stiller Avatar asked Dec 23 '22 12:12

Bobby Stiller


1 Answers

You can try:

df = df.append(df.iloc[0], ignore_index=True)
like image 134
student Avatar answered Dec 28 '22 06:12

student