#5, First Floor, 4th Street , Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

How to bind rows into a data frame using python?
Description

To concatenate new rows with a data frame in python.

Process

  Get the sample data.

  Make two different data frame.

  Binding the needed row from one to another data frame.

  Its used to take the row,what we want.

Sapmle Code

#import library
import matplotlib.pyplot as plt
import pandas as pd

#10 sample data
data={‘name’:[‘sathish’,’raj’,’raja’,’krishna’,’yusuf’],
‘salary’:[100,200,300,400,500],
‘age’:[25,26,25,23,30],
‘rating’:[4,3.24,2.5,2.25,2]}
data1={‘name’:[‘praveen’,’sangee’,’ezhil’,’dinesh’,
‘ganesh’],
‘salary’:[400,300,200,100,50],
‘age’:[29,23,23,24,25],
‘rating’:[2.25,2.5,2.75,3.2,4.2],
‘bonus’:[1400,850,250,750,1000]}
df=pd.DataFrame(data)
df1=pd.DataFrame(data1)

print(“First Data frame”)
print(df)
print(“Second Data frame”)
print(df1)

#Concatenate the row from data frame df1
df.append(df1,sort=False)

Screenshots