Add rows to Pandas DataFrame

Create two data frames and append the second to the first one

# Importing pandas as pd 
import pandas as pd 

# Creating the first Dataframe using dictionary 
df1 = df = pd.DataFrame({"a":[1, 2, 3, 4], 
            "b":[5, 6, 7, 8]}) 

# Creating the Second Dataframe using dictionary 
df2 = pd.DataFrame({"a":[1, 2, 3], 
          "b":[5, 6, 7]}) 

# Print df1 
print(df1, "\n") 

# Print df2 

Now append df2 at the end of df1.

# to append df2 at the end of df1 dataframe 

Notice the index value of second data frame is maintained in the appended data frame. If we do not want it to happen then we can set ignore_index=True.

# A continuous index value will be maintained 
# across the rows in the new appended data frame. 
df.append(df2, ignore_index = True)