5.Read the ‘Student_result.csv’ to create a data frame and do the following operation:
To display Adm_No, Gender and Percentage from ‘Student_result.csv’ file.
To display the first 5 and last 5 records from ‘student_result.csv’ file.
Solution :-
import pandas as pd import csv
# To Display the Data df=pd.read_csv(“Student.csv”,usecols=[‘Adm_No’,’Gender ‘,’Perc’]) print(“To display Adm_No, Gender and Percentage from ‘student_result.csv’ file.”) print(df)
# To display first 5 and last 5 records from ‘student_result.csv’ file. df1 = pd.read_csv(“Student.csv”) print(df1.head()) print(df1.tail()) ‘’’No Value in bracket of head and tail means taking default value which is 5.’’’