[go: up one dir, main page]

0% found this document useful (0 votes)
104 views7 pages

Importing and Exporting Data Between CSV Files and

The document explains the process of importing and exporting data between CSV files and DataFrames in Informatics Practices for Class XII. It details the structure of CSV files, the functions used to read from and write to CSV files using Pandas, and includes multiple-choice questions for recap. Additionally, it provides an assignment to create and manipulate employee records in a CSV file.

Uploaded by

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

Importing and Exporting Data Between CSV Files and

The document explains the process of importing and exporting data between CSV files and DataFrames in Informatics Practices for Class XII. It details the structure of CSV files, the functions used to read from and write to CSV files using Pandas, and includes multiple-choice questions for recap. Additionally, it provides an assignment to create and manipulate employee records in a CSV file.

Uploaded by

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

IMPORTING AND EXPORTING

DATA BETWEEN CSV FILES


AND DATAFRAMES
CLASS- XIIB
SUBJECT- INFORMATICS PRACTICES
COMMA SEPARATED VALUE FILE
• A COMMASEPARATED VALUE (CSV) FILE IS A TEXT FILE WHERE VALUES ARE SEPARATED BY
COMMA. EACH LINE REPRESENTS A RECORD (ROW).
• THIS FILE IS USED TO STORE THE DATAFRAME CONTENT PERMANENTLY ON STORAGE DEVICE.
• EACH ROW CONSISTS OF ONE OR MORE FIELDS (COLUMNS). THEY CAN BE EASILY HANDLED
THROUGH A SPREADSHEET APPLICATION.
IMPORTING A CSV FILE TO A DATAFRAME
• STORE OR EXPORT DATA IN A DATAFRAME AS A .CSV FILE.
• THE FUNCTION USED TO STORE DATA AS CSV FILE:-
• SYNTAX:-
• FILE_OBJECT=PANDAS.READ_CSV(“FILE LOCATION”)
CSV file (month.csv)on
F1= PD.READ_CSV(“MONTHS. CSV",SEP =",", HEADER=0) spreadsheet

PRINT(F1)

DataFrame f1 after
read data from file
EXPORTING A DATAFRAME TO A CSV FILE
• USE THE TO_CSV() FUNCTION TO SAVE A DATAFRAME TO A TEXT OR CSV FILE.
• SYNTAX:- Set False to not save
Set False to not save
column names on file index label on file

• DF_OBJ.TO_CSV(“FILE NAME WITH LOC”, SEP=',’ ,HEADER = FALSE, INDEX= FALSE)


MCQ-RECAPITULATION
• WHAT CSV STANDS FOR?
1. COMMON SPECIAL VALUES
2. COMMA SEPARATED VALUES
3. COMMON SYMBOL VALID
4. NONE OF THESE
WHICH FUNCTION IS USED TO STORE DATA OF DATAFRAME IN CSV FILE.
1. DF.TO_CSV()
2. PD.READCSV()
3. PD.STORE_CSV()
4. PD.TO_CSV()
CONTINUE…..
• WHICH FUNCTION IS USED TO READ DATA FROM CSV FILE.
1. DF.CSV_READ()
2. PD.READ_CSV()
3. PD.TO_READ()
4. NONE OF THESE

• WHAT DO YOU MEANS BY IMPORT AND EXPORT DATA?


ASSIGNMENT:-

• CREATE A DATAFRAME OF EMPLOYEES RECORDS AND STORE IN “EMP.CSV” FILE.


• READ THE DATA FROM “EMP.CSV” AND DISPLAY ON SCREEN.

You might also like