SlideShare a Scribd company logo
Data Transfer Between Files, Databases
and DataFrames
Based on CBSE Curriculum
Class -11
By-
Neha Tyagi
PGT CS
KV 5 Jaipur II Shift
Jaipur Region
Neha Tyagi, PGT CS II Shift Jaipur
Introduction
Neha Tyagi, PGT CS II Shift Jaipur
• In the last chapter we have learnt about python pandas library
in which we have gone through dataframes and series.
• In this chapter we will see that how to change data into .CSV
file and how to import data in the program from a .CSV file.
(.CSV file, is a file of Comma Seperated Values from which
data can be taken to a dataframe and vice-versa).
• In this chapter we will learn that how to connect a database
table with python by SQL commands.
Data transfer between DataFrames and .CSV file
Neha Tyagi, PGT CS II Shift Jaipur
• CSV format is a kind of tabular data separated by comma and
is stored in the form of plaintext.
In CSV format-
• Each row of the table is stored in one row.
• The field-vales of a row are stored together with comma after
every field value.
Advantages of CSV format-
• A simple, compact and ubiquitous format for data storage.
• A common format for data interchange.
• It can be opened in popular spredsheet packages like MS-EXCEL etc.
• Nearly all spredsheets and databases support import/export to csv
format.
Roll No Name Marks
101 Ramesh 77.5
102 Harish 45.6
Tabular Data
After conversion to CSV Format
Roll No., Name,Marks
101,Ramesh,77.5
102,Harish,45.6
Loading Data from CSV to DataFrame
Neha Tyagi, PGT CS II Shift Jaipur
Emp.csv file , in tabular format Emp.csv file , in Notepad format
Neha Tyagi, PGT CS II Shift Jaipur
import pandas as pd
<DF>=pd.read_csv(<FilePath>)
• Assume the file path as c:dataemp.csv then following type of
file will be opened-
Reading from a CSV file to DataFrame
Neha Tyagi, PGT CS II Shift Jaipur
• If a file does not have top row i.e. Headings then it is possible
to provide headings in python.
Reading from a CSV file to DataFrame
Headings does nt come
from header=None
It takes data by skipping one
row from skiprows = 1
Neha Tyagi, PGT CS II Shift Jaipur
Reading selected lines fron CSV file
Use of nrows= <n>
Reading from CSV file when separator is other than comma
Use of sep= <char>
Neha Tyagi, PGT CS II Shift Jaipur
import pandas as pd
<DF>.to_csv(<FilePath>)
or
<DF>.to_csv(<FilePath>,sep=<char>)
• Suppose our file path is c:datadata.csv then -
Writing from a DataFrame to CSV file
Here @ is used
as seperator
If there os NaN
values then it is
stored in file as
empty string.
Data transfer between DataFrames and SQL Database
Neha Tyagi, PGT CS II Shift Jaipur
• In this chapter we will learn that how to transfer data from SQL
table with the help of sqlite3 library of python. sqlite3 comes
inbuilt with python. sqlite3 library deals with SQLite databases.
• Use www.sqlite.org/download.html to download Sqlite3.
• We work on sqlite> prompt on Sqlite3. It supports all
commands of SQL which are supported by mysql.
Data transfer between DataFrames and SQL Database
Neha Tyagi, PGT CS II Shift Jaipur
Here sqlite3 is installed.
Creation of table in sqlite3 is shown here.
Data transfer between DataFrames and SQL Database
Neha Tyagi, PGT CS II Shift Jaipur
Data has
transferred to
database from
DataFrame.
Plotting from DataFrames
Neha Tyagi, PGT CS II Shift Jaipur
Use pip install for installing matplotlib module.
Plotting from DataFrames
Neha Tyagi, PGT CS II Shift Jaipur
Thank you
Please follow us on our blog
Neha Tyagi, KV 5 Jaipur II Shift
www.pythontrends.wordpress.com

More Related Content

Similar to Chapter-12eng-Data-Transfer-Between-Files-SQL-Databases-and-DataFrames.pdf

Hadoop_File_Formats_and_Data_Ingestion.pptx
Hadoop_File_Formats_and_Data_Ingestion.pptxHadoop_File_Formats_and_Data_Ingestion.pptx
Hadoop_File_Formats_and_Data_Ingestion.pptx
ShashankSahu34
 
Mapping Data Flows Training deck Q1 CY22
Mapping Data Flows Training deck Q1 CY22Mapping Data Flows Training deck Q1 CY22
Mapping Data Flows Training deck Q1 CY22
Mark Kromer
 
Pa2 session 2
Pa2 session 2Pa2 session 2
Pa2 session 2
aiclub_slides
 
Cassandra data modelling best practices
Cassandra data modelling best practicesCassandra data modelling best practices
Cassandra data modelling best practices
Sandeep Sharma IIMK Smart City,IoT,Bigdata,Cloud,BI,DW
 
Machine learning session 5
Machine learning session 5Machine learning session 5
Machine learning session 5
NirsandhG
 
Rank Your Results with PostgreSQL Full Text Search (from PGConf2015)
Rank Your Results with PostgreSQL Full Text Search (from PGConf2015)Rank Your Results with PostgreSQL Full Text Search (from PGConf2015)
Rank Your Results with PostgreSQL Full Text Search (from PGConf2015)
Jamey Hanson
 
Python Pandas.pptx
Python Pandas.pptxPython Pandas.pptx
Python Pandas.pptx
SujayaBiju
 
MuleSoft Surat Virtual Meetup#30 - Flat File Schemas Transformation With Mule...
MuleSoft Surat Virtual Meetup#30 - Flat File Schemas Transformation With Mule...MuleSoft Surat Virtual Meetup#30 - Flat File Schemas Transformation With Mule...
MuleSoft Surat Virtual Meetup#30 - Flat File Schemas Transformation With Mule...
Jitendra Bafna
 
Streaming in Mule
Streaming in MuleStreaming in Mule
Streaming in Mule
Pankaj Goyal
 
Hadoop Summit 2014: Query Optimization and JIT-based Vectorized Execution in ...
Hadoop Summit 2014: Query Optimization and JIT-based Vectorized Execution in ...Hadoop Summit 2014: Query Optimization and JIT-based Vectorized Execution in ...
Hadoop Summit 2014: Query Optimization and JIT-based Vectorized Execution in ...
Gruter
 
Understanding and building big data Architectures - NoSQL
Understanding and building big data Architectures - NoSQLUnderstanding and building big data Architectures - NoSQL
Understanding and building big data Architectures - NoSQL
Hyderabad Scalability Meetup
 
Pandas Dataframe reading data Kirti final.pptx
Pandas Dataframe reading data  Kirti final.pptxPandas Dataframe reading data  Kirti final.pptx
Pandas Dataframe reading data Kirti final.pptx
Kirti Verma
 
Apache Tajo: Query Optimization Techniques and JIT-based Vectorized Engine
Apache Tajo: Query Optimization Techniques and JIT-based Vectorized EngineApache Tajo: Query Optimization Techniques and JIT-based Vectorized Engine
Apache Tajo: Query Optimization Techniques and JIT-based Vectorized Engine
DataWorks Summit
 
Bdc details
Bdc detailsBdc details
Bdc details
Syam Sasi
 
Mapping Data Flows Training April 2021
Mapping Data Flows Training April 2021Mapping Data Flows Training April 2021
Mapping Data Flows Training April 2021
Mark Kromer
 
Azure Data Factory Data Flows Training (Sept 2020 Update)
Azure Data Factory Data Flows Training (Sept 2020 Update)Azure Data Factory Data Flows Training (Sept 2020 Update)
Azure Data Factory Data Flows Training (Sept 2020 Update)
Mark Kromer
 
Pandas-(Ziad).pptx
Pandas-(Ziad).pptxPandas-(Ziad).pptx
Pandas-(Ziad).pptx
Sivam Chinna
 
Anatomy of Data Source API : A deep dive into Spark Data source API
Anatomy of Data Source API : A deep dive into Spark Data source APIAnatomy of Data Source API : A deep dive into Spark Data source API
Anatomy of Data Source API : A deep dive into Spark Data source API
datamantra
 
data stage-material
data stage-materialdata stage-material
data stage-material
Rajesh Kv
 
MODULE 5.pptx
MODULE 5.pptxMODULE 5.pptx
MODULE 5.pptx
lathass5
 

Similar to Chapter-12eng-Data-Transfer-Between-Files-SQL-Databases-and-DataFrames.pdf (20)

Hadoop_File_Formats_and_Data_Ingestion.pptx
Hadoop_File_Formats_and_Data_Ingestion.pptxHadoop_File_Formats_and_Data_Ingestion.pptx
Hadoop_File_Formats_and_Data_Ingestion.pptx
 
Mapping Data Flows Training deck Q1 CY22
Mapping Data Flows Training deck Q1 CY22Mapping Data Flows Training deck Q1 CY22
Mapping Data Flows Training deck Q1 CY22
 
Pa2 session 2
Pa2 session 2Pa2 session 2
Pa2 session 2
 
Cassandra data modelling best practices
Cassandra data modelling best practicesCassandra data modelling best practices
Cassandra data modelling best practices
 
Machine learning session 5
Machine learning session 5Machine learning session 5
Machine learning session 5
 
Rank Your Results with PostgreSQL Full Text Search (from PGConf2015)
Rank Your Results with PostgreSQL Full Text Search (from PGConf2015)Rank Your Results with PostgreSQL Full Text Search (from PGConf2015)
Rank Your Results with PostgreSQL Full Text Search (from PGConf2015)
 
Python Pandas.pptx
Python Pandas.pptxPython Pandas.pptx
Python Pandas.pptx
 
MuleSoft Surat Virtual Meetup#30 - Flat File Schemas Transformation With Mule...
MuleSoft Surat Virtual Meetup#30 - Flat File Schemas Transformation With Mule...MuleSoft Surat Virtual Meetup#30 - Flat File Schemas Transformation With Mule...
MuleSoft Surat Virtual Meetup#30 - Flat File Schemas Transformation With Mule...
 
Streaming in Mule
Streaming in MuleStreaming in Mule
Streaming in Mule
 
Hadoop Summit 2014: Query Optimization and JIT-based Vectorized Execution in ...
Hadoop Summit 2014: Query Optimization and JIT-based Vectorized Execution in ...Hadoop Summit 2014: Query Optimization and JIT-based Vectorized Execution in ...
Hadoop Summit 2014: Query Optimization and JIT-based Vectorized Execution in ...
 
Understanding and building big data Architectures - NoSQL
Understanding and building big data Architectures - NoSQLUnderstanding and building big data Architectures - NoSQL
Understanding and building big data Architectures - NoSQL
 
Pandas Dataframe reading data Kirti final.pptx
Pandas Dataframe reading data  Kirti final.pptxPandas Dataframe reading data  Kirti final.pptx
Pandas Dataframe reading data Kirti final.pptx
 
Apache Tajo: Query Optimization Techniques and JIT-based Vectorized Engine
Apache Tajo: Query Optimization Techniques and JIT-based Vectorized EngineApache Tajo: Query Optimization Techniques and JIT-based Vectorized Engine
Apache Tajo: Query Optimization Techniques and JIT-based Vectorized Engine
 
Bdc details
Bdc detailsBdc details
Bdc details
 
Mapping Data Flows Training April 2021
Mapping Data Flows Training April 2021Mapping Data Flows Training April 2021
Mapping Data Flows Training April 2021
 
Azure Data Factory Data Flows Training (Sept 2020 Update)
Azure Data Factory Data Flows Training (Sept 2020 Update)Azure Data Factory Data Flows Training (Sept 2020 Update)
Azure Data Factory Data Flows Training (Sept 2020 Update)
 
Pandas-(Ziad).pptx
Pandas-(Ziad).pptxPandas-(Ziad).pptx
Pandas-(Ziad).pptx
 
Anatomy of Data Source API : A deep dive into Spark Data source API
Anatomy of Data Source API : A deep dive into Spark Data source APIAnatomy of Data Source API : A deep dive into Spark Data source API
Anatomy of Data Source API : A deep dive into Spark Data source API
 
data stage-material
data stage-materialdata stage-material
data stage-material
 
MODULE 5.pptx
MODULE 5.pptxMODULE 5.pptx
MODULE 5.pptx
 

Recently uploaded

Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
S. Raj Kumar
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 

Recently uploaded (20)

Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 

Chapter-12eng-Data-Transfer-Between-Files-SQL-Databases-and-DataFrames.pdf

  • 1. Data Transfer Between Files, Databases and DataFrames Based on CBSE Curriculum Class -11 By- Neha Tyagi PGT CS KV 5 Jaipur II Shift Jaipur Region Neha Tyagi, PGT CS II Shift Jaipur
  • 2. Introduction Neha Tyagi, PGT CS II Shift Jaipur • In the last chapter we have learnt about python pandas library in which we have gone through dataframes and series. • In this chapter we will see that how to change data into .CSV file and how to import data in the program from a .CSV file. (.CSV file, is a file of Comma Seperated Values from which data can be taken to a dataframe and vice-versa). • In this chapter we will learn that how to connect a database table with python by SQL commands.
  • 3. Data transfer between DataFrames and .CSV file Neha Tyagi, PGT CS II Shift Jaipur • CSV format is a kind of tabular data separated by comma and is stored in the form of plaintext. In CSV format- • Each row of the table is stored in one row. • The field-vales of a row are stored together with comma after every field value. Advantages of CSV format- • A simple, compact and ubiquitous format for data storage. • A common format for data interchange. • It can be opened in popular spredsheet packages like MS-EXCEL etc. • Nearly all spredsheets and databases support import/export to csv format. Roll No Name Marks 101 Ramesh 77.5 102 Harish 45.6 Tabular Data After conversion to CSV Format Roll No., Name,Marks 101,Ramesh,77.5 102,Harish,45.6
  • 4. Loading Data from CSV to DataFrame Neha Tyagi, PGT CS II Shift Jaipur Emp.csv file , in tabular format Emp.csv file , in Notepad format
  • 5. Neha Tyagi, PGT CS II Shift Jaipur import pandas as pd <DF>=pd.read_csv(<FilePath>) • Assume the file path as c:dataemp.csv then following type of file will be opened- Reading from a CSV file to DataFrame
  • 6. Neha Tyagi, PGT CS II Shift Jaipur • If a file does not have top row i.e. Headings then it is possible to provide headings in python. Reading from a CSV file to DataFrame Headings does nt come from header=None It takes data by skipping one row from skiprows = 1
  • 7. Neha Tyagi, PGT CS II Shift Jaipur Reading selected lines fron CSV file Use of nrows= <n> Reading from CSV file when separator is other than comma Use of sep= <char>
  • 8. Neha Tyagi, PGT CS II Shift Jaipur import pandas as pd <DF>.to_csv(<FilePath>) or <DF>.to_csv(<FilePath>,sep=<char>) • Suppose our file path is c:datadata.csv then - Writing from a DataFrame to CSV file Here @ is used as seperator If there os NaN values then it is stored in file as empty string.
  • 9. Data transfer between DataFrames and SQL Database Neha Tyagi, PGT CS II Shift Jaipur • In this chapter we will learn that how to transfer data from SQL table with the help of sqlite3 library of python. sqlite3 comes inbuilt with python. sqlite3 library deals with SQLite databases. • Use www.sqlite.org/download.html to download Sqlite3. • We work on sqlite> prompt on Sqlite3. It supports all commands of SQL which are supported by mysql.
  • 10. Data transfer between DataFrames and SQL Database Neha Tyagi, PGT CS II Shift Jaipur Here sqlite3 is installed. Creation of table in sqlite3 is shown here.
  • 11. Data transfer between DataFrames and SQL Database Neha Tyagi, PGT CS II Shift Jaipur Data has transferred to database from DataFrame.
  • 12. Plotting from DataFrames Neha Tyagi, PGT CS II Shift Jaipur Use pip install for installing matplotlib module.
  • 13. Plotting from DataFrames Neha Tyagi, PGT CS II Shift Jaipur
  • 14. Thank you Please follow us on our blog Neha Tyagi, KV 5 Jaipur II Shift www.pythontrends.wordpress.com