Q. 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]
Answer :-
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
>>>
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )