1
27/11/2022 12:02 pm
Topic starter
Write a Python code to create a dataframe with appropriate headings from the list given below :
[ ‘S101’,’Amy’,70],[‘S102’,’Bandhi’,69],[‘S104’,’Cathy’,75],[‘S105’,’Gundaho’,82]
1 Answer
1
27/11/2022 12:07 pm
Topic starter
Code:
import pandas as pd data = ['S101','Amy',70],['S102','Bandhi',69],['S104','Cathy',75],['S105','Gundaho',82] df = pd.DataFrame(data, columns = ['ID', 'Name', 'Marks']) print(df)
Output:
ID Name Marks 0 S101 Amy 70 1 S102 Bandhi 69 2 S104 Cathy 75 3 S105 Gundaho 82