0% found this document useful (0 votes)
17 views1 page

Practical Programs-5 (CSV Operations)

The document provides instructions for programs to read and manipulate data from a CSV file called 'student_result.csv'. It includes displaying specific columns, and the first and last 5 records from the file.

Uploaded by

Om Banerjee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views1 page

Practical Programs-5 (CSV Operations)

The document provides instructions for programs to read and manipulate data from a CSV file called 'student_result.csv'. It includes displaying specific columns, and the first and last 5 records from the file.

Uploaded by

Om Banerjee
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

PRACTICAL PROGRAMS

SUB-IP XII-C
TOPIC- CSV Operations

WRITE ALL THE PROGRAMS IN THE COMPUTER PRACTICAL COPY ONLY.


Q1. 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.

import pandas as pd
import csv
#To display Adm_No, Gender and Percentage from ‘student_result.csv’ file.
df = pd.read_csv("student_result.csv",usecols = ['ADM_NO','GENDER', 'PERCENTAGE'])
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_result.csv")
print(df1.head())
print(df1.tail())

You might also like