0 ratings0% found this document useful (0 votes) 24 views7 pagesCSV Files + Matplotlib
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
+ || csv ¢ comma separated yautes): A tex file where vote are siparated
Loy comma, Gach line represen’ a FecOrd , €Ach vous coTuiLH Of one or “more
Sielas “
> ||_esv giles can ve opened in any tA editor Uke Notepad, fn spreadaneet
pike MS Excel.
|| esv files con store mts. of data d occupy very [es space.
=) || wAiTing DATAFRAME 1NTO CSV FILES
To sowe the data of tne datatrame into csv Hie, we we +
£0 csv C) method:
datotrame to csv complete path of csv file)me xp Name savany
9° 01 Aniructn 30000
1 102. Prabnat, 85000
2 10a Apna. 32000
a0 Rehan _32000 4
<5 Kowita 89000
emp? pd. pataframes ¢-empip
£101,102, 103 10,1051, same. |
Leanirucin’, “frabnog’ ‘Abha', “®tnan! Kavita’
‘Salary’: £40009 36000, 93000, 92080 2000
print C'tmployee oetaily’
print {Fae emp)
temp. #6¥ Lo_ csv (NE: | employee, cry”)
rine (Data writen In csv fie)
Panamerees
der If you don't want to saue the column 0 tn cov Filey
then we can set neader = *hatse%
tmp. 0 c8V (" E:\ employee csv", neaser
“alue
dex: f we don'e want
we abet, to pe written fn c6v file the,
\¢ con_cetindew = False,
bo csv C" E:\ emplouge, cv", index = aise)
rut
Matd_fo_change he separator characley gy default the_smfpATiN OMTAERAME FRom ev fue TO pATAERAME _
[te do tnis me ue
p—— _______
ont 0m _esv = Eanes
tn
tne rs sept ety ine oe character
ey the separator character in csv files can be se te
THE DgPAUT SEPARATOR WHILE RERDING FROM cov FILES TO DATRFRAME
ee
eh SPecibies THE NO: of ROWS YAL WHOSE VAWES ARE TO 65
| sto ag cowume name. neader +0 means THAT THE 4! Row in Cv SE
eae eas(lanes oul:
NI —— DATA Vs
| gras, cnart etc
+ | onmm vieveusnnen Graenicat yada sl fon ot dato using —
| visalintia ips ie net tecsindg_ of cist of dala ona
etectiveiy sornmunteate Informati’n to
Te
ate si walfsotion eres 10
Sieenltaas
—L im ote of plot data is to visualise variations oft show
Dee Ge eee leat amaae
Ss 1vTax: | import _matpiatib. pyplat os pit
Sa + COARKE OF CLADE
ET f Plot» Ans Tine
pire oF et is
fae gene eae Le |
fuel ele enact pee " L
T ¥¢Y babel Hier
ett a comfangn of gant
_t {|| wine qeaeH spuot :
7 I
Te] ATMA
I Vv
drone t
SYNTAX:
eT eal
Rae wa=
091) 40 be ploHed when data for grass © °°"
Import natplatiib. ayplot at pit sp} >
sng—marks + (15,10, 20.25, 301
cl
ShOWO mtined: Sisplays the raph on ihe Jere
1. show O
PLOT WHEN DATA goR ROTH X 4 1-AIC 1S GIVEN
sku. * [/Ravi", ‘Apna’ *Ritu' * Sheetal’, “Hema” 1
git plot sta name, ¢ng.amarks) agar
pit. show 3.4 $3
ennai sis
arks + (9 10, 2025.30 = ~
hindinmacks + (20 15, 25,30. 20] sé —
sCRavi'..... same =
ee
se tne ESERIES apna? BEI EE
L pit plot (stud-name, 2g! marks) Nin
(ee nc ee
pk yang enh
way rm {ait aticss cong.
egt: ADDING LABEL To AXIS
pit abel + C Name of shusents’)
wie. yiadel + (Marks!)
bel C1 meinad: Used ttn a. tabel fpr xan
it, niopel * Ciena)
ylabei0? method: used to anige a label for yeonit
janet * clave?
site CO method: sed 40 ieiey autlin ane tise Gor he chart
# coalueFf itgenao> meno: used fo sinpiny tegtnd sor ine gfver plot
SS vnstnae tegen.
Vet So
\ Lor C2 mtthed: used to spalty colour of tne fh
¥ Cay, coes* a ats
rm
1: || raneit) method: used to mention me mame of Whe tine ¢ will pe sisplayed
+ fn tegend. GHP _¢ label =" capetname’)
14 | tinesiyiecr memod Used 40 specify the style of a tine, con take tne
ssuoutog vat Caioesigle = * Linestyie’)
te [cst ae tet th draws catia tine
“dounea’ or =~! tt drouss @ dashed tine
{ daandot ox Ae deouss @_dasmdattd foe
iv. || saoned’ or “4's st drow a contd tine
4110+ | inewidth © meted: sed to epectfy the wlth of the Line fo pine!
Cine width 244 number?
eg: | ne bat spe sad
m2 5 10 20,18, 35].
. style =
7
Linewidi = 2)
2 | cetour _abbreviafions:
sf se = sue 5: “p= magenta
2 | 9) = green 62 f= yetlow
2 r/ = red 42 tet = blak?
wef se* = cyan La! wanite
cit [markers A sy mbor whit cepeteald “ania vase ‘te. @ Gnalehareae J
marker pammekt cam jake the following values:
wo oe!
- star £8’ octagon
So’ cirele tv’ triangle down (9)
ts! square
Ga] markersize : sfre of syne marker,