1.

Write a python code to create a data frame with appropriate headings from the list given below :['S101', 'Amy', 70], ['S102', 'Bandhi', 69], ['S104', 'Cathy', 75], ['S105', 'Gundaho', 82]

Answer»

import pandas as pd 

# initialize list of lists

data = [['S101', 'Amy', 70], ['S102', 'Bandhi', 69], ['S104',

'Cathy', 75], ['S105', 'Gundaho', 82]]

# Create the pandas DataFram

 df = pd.DataFrame(data, columns = ['ID', 'Name', 'Marks'])

# printdataframe. print(df )



Discussion

No Comment Found

Related InterviewSolutions