0% found this document useful (0 votes)
4 views

L1 python Pandas 1 series notes (1)

The document discusses the use of the Pandas library for data analysis, focusing on data structures such as Series and DataFrames. It covers various functionalities including data manipulation, indexing, and handling missing values. The document also emphasizes the importance of organizing and filtering data effectively.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

L1 python Pandas 1 series notes (1)

The document discusses the use of the Pandas library for data analysis, focusing on data structures such as Series and DataFrames. It covers various functionalities including data manipulation, indexing, and handling missing values. The document also emphasizes the importance of organizing and filtering data effectively.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

HAJA MAHAL

Date
Expt. No
PAN DAS land Data Syatem l stauctue Ni
-fev data analyais
ecometcA tesm faL multidimensi'onal sautwhel
dataeti
aut her 6 Pamdas wes- Mckinney
2 data sthuctne louea Datatname.
9t efem
need to inpot þanalas lib. as
intont fanelaa
wHY PANAs 22

Caw head ct in mamy dig data famab


lintifoat deuble, at, ete.)
Can
sesand calum
Pganised dlata
Can casiy alect
Rebset
fram big data
Can ceebine mltiple data eeto
Can data
Can ofbly of to inde7emeent gioufa uithin data
eutfaati sedloating data
-sutjat ieualiatio hy dpeting matpdl:6,
ete lib:t

Teacher's Signature :
PANbAS
DS

accs

dncabio aceued noso columnt a l

Drla Suctus 5 lanelar


Seies Dodafrane fanel
DATA FRAME
PRoPURIY SERIEs
menien
Homogenecus sa tteteicgeneous
Dieta ghe element can ae
lata tyhe 3libeen data Ty
Puitabiliy Va mitakle Vaimetable
edememts val, Cam ke blemento yal com ae
chang ckanget
Sie mttable
Size Dmmctable
aivbetemet
addiglde,
in
ponible
aeie is uele
once

chang place
to do a ne seies Loart, t cem e
HALIA MAHAL

Date
Paga No.
SLRIES DS

ala neleyed dater


date
4sociated
atay hdexes Chumenie iader)
data labelh (Lebeled index)
waed to acesel indindul al

Dat Dadey Datr

20 B 20 Lakellel
boaitoual
adlese g0ndexea

Cees
Dieet aeating
ionport pandas

no values

S1

Teachers Signature:
Jo CALate non
ieikg gumintodata incleres
Sy Seies
Taz = volid numaby data
()
() ndaay

(iV)Scalan value

SL- . Senies (CI, 2,3,4J)

I 2
2 3
3 4

OS1= fel. Seies (iamge l5))


1
2 2
3

ndaayqiue date as
Exp Ne

Ss

Ss
2

S1
fCeaie, (np. tils ,lo], 2))

2
2

)Seneo Data as

S1
2 20

3 B0

iv) Series data aa Acolas value


4 data is scala then ndex alues ae mit
S1 outfu Lit
heldod
Teacher's Signature
JO
2

stapnlue
Ls stat vaue
S1 sEl alue
3 J0
5 10

S1
4=pd. Sesies CJo, inolex C'A',Bc'3)

t SERIES CREATIDN wit tDDITION-AL fUNCTIONALITY


) NaN uelues
9t can be dlone in
Gnb.NaN’ Not a Nake Laetined i Numpy nodule )
B None
Os1 = pl. SeueslCi, nþ.NaN,3])
S1
O 1

1 npNan
2 3

Os1 = pd. Seies lE I, None, 3J)


SL
1
None
Date
Page No
Exp. No Shivalal)

data d ndep paaunetey


Rxd C 2,3J
szhd.Seies lolata d indeyi)

S1
A 1
2
C 3

S1
1
b

Teacher's Signature
hould eplcty
be cqual o the
fecfied ttew theley values
values in
Aata auay, othtsusise
Tdces Ualve tono
need wot ae unigue in lanolas Seies Ob
petging data yhe alao

dhyhe- Ncne )
Ex:- O Ss = pd. Seaces ldata = C,2,3], indey CA',B,C],
ghetfot bl ))

A
2

lyhe flot 64
Sane tnderes sil cauee
ohuatia thet aquie unigue inclicer.
HAWA MAHAL

Date:
Page No. 2
Expt N

Seiee ing Mathtmalical fh,

np asamge (9, 15)


þaiatla)
l4,10, IL 12, 13, 14, 15]
S1 =þd. Seies lindex =a, data = at2)
18
(0 20

22

12 24
3 26
28
30
L=Ci,2]
S1= þl.Seiesldata = (2* LJ)
2
Casit aeklicateo)
2

Aeries wth dulioate iacdes yal.


Lompulaion uniqueuen inder
SA þd. Aeies data , 2,3], nalex =('a', 'a'BI)
a 1 toggher'g Signature s . . . t

b
tlnat Acquie Lvigue indices.
atore alata

S1 = bd. Seies l CI,2,33) :St- þod sees U,.11)

1 2
2 3
1.dtye:flot6t
4+ Cheeing flot ceies sehies
si pl. Series (CI,1, 2-2J) S1 = hd. Seies (U. I1, 'a' J)

1 2-2
2 a'

cHyfeiftot object
Capalle to hold al
t Seies Object tlibutea
<L obi>. <atibute names
gwes info abt seieo

) <Lees. eli.. inde tnde logs labelo) the aeres


st =pd, Setes CCI,2, 33kalo ineCa,'b, )
S1. tndex

=aleot io waet to
HAUIA MAHAL
Date:
Expt No Page No. :

() ks. oi.index. Mome ne inder name to


indey
Si. indeY; name
Jueler
= Imoley'
2

-3

#<s fa>. jaluea= Aetusn eeies ndasag


LasaslCI, 2,3], ttyhe int c4)
name = name to Reies
S1. ame= 'Seie

2
2

Naae; Senies, dtyheit


81.name
Seie'

<S. data

intG4')

S4.ahahe Teacher's Signature


lemento it cotain ineldig

. ndim etuw numke dinenusns.


S1, ndim

24
C-totel element 3 +8 layteo] =24 Bye,
edemet
3

(x) <s"o itemLiee Aetun data


S1-itemciee

(xi) hasna NaN valuer


falhe no Na valu
) Si. haonans
falo

falae

S1. cou t

lelsa ’3 (oe)
HAUA MAHAL

Date

Expt No
Poge No, .
indiiuel lemett. d
Aceting
Lol42Lil
S1C'a'
1
62 al the velue wil ala

4ineleyes dest exist, it sall gie


alices

Lndex mea

Si Co: 2:1]
2

AeelAe erder
2

a 1

TF OPERATIONS ON SERIES OBTECI


Modikying cleenta <sobiz (sindexi=
Teacher's Signature
<newdataval>
1val cam Se auigned
<nedtaval>
<S-ey Cstat : sbop]
Dp
Ex- Sis d. Seies (CI, 2. 2,4J) ’
1 2

dtyhe: int ey
Cout) C
1 2
2 3
34

S1 Co:3] = 20
20
2 20
3 L

# RENAnING INDEXES
Seies inslex com be charged /molif
indep aMAt aize mest
SL.indep

head) f :fetel fat n fam fandas Ofeet


tailcf :fete Aast n -
Spi-< hd.osi> .ead lEn])
<pd. oly.>. tacln1) l
si.head (2)
20 fele t t
It1. headl)
20
- 20

iemee defalt5 Jous


3 4 n val. not olefined..
HALUN MAHAL

Date
Pags No
SA t a c (3)
Ept

2Nou.
20
Jlast
3 4

S1.tau(5)
20 ast 5Aoues

2 20
4

Seies
then
LO
Ex
20

S1t2 si-2 S1* 2 siH2


12
b 40 b JO.0
22

C 32 28 C 15.O
42 38
d20-0 20

S1<20
100

b 400 b fala b fale


400
1600 Taue d fale
Teachos Signature :
Anthoneic Dheadce
-data aliged boais fudexeo
Cvinlapbng inlexes , anitmetcs
Acolt as a Na Cnet a nunben) sheik ejaesent
nisteing value
Si= S2 a lo S3= 30
b 20 b 20 te d 0

a Nan c Napl
b Nan
b 40
C Na aNa
d Na b Na

# fiLTERIN ENRIES; Spir SA


SL 0
-Applyng compaiaow ofato diectly
vectoiaed b falee
e. abplies tis checte en ea ah element
Aetun Thue Hola ter eacl elemet
When the check io afpliedcin the fom
4uiecd seaut centainng Cnly tle elemets
that etun me ter the bool cxþ.
Seies Vaues Lndlex
S1.poinelen U
b 20

40 40 20

Tawe lfala J)
I Difeatnie Betstsm HALUn MHAL

Date
Page No
Expt N

Data SAauctus Sbelata atctun ene


miltidinenimal wstt
nected iat in it
hane
Labelled indey
Suppest cxact indesig Subpest ionflicat sedegdog,
cam pacqsammal ie indexes ae danliely

AToderea cdin ke duplicale Dadese


duplcate
5 Hogenous elemet Hetecaencus eleeanks -
-atee element 5 aames ’pler element a dig
data tyhs
betueeen Seiea amd Ditisny
SERIES DICTIONARY

meltidimensiesal with
nested dictionanyinit
2ndex nulmei as weell as aAe cOnaiclecl a
lakelled index
be Qinmitab
Cam

Toache's Signature
namtut |labele (stig) backisasdrdesingLumeio)

4 Memoiy i- takes mo
enfaned to Seaies.

-Additional Cheatiom
tou wsat to Aeate a eimilar obi but wath

Sys= Ss. neinoe ([aa', b c )


S1 1

b 20
Beetolletia
ltabulal'spesdik)
celuaNe

32 olereo ow insleyes inelests


columa
SColumns
Value eclalle -
4 e mutasl

Ceating lDafplay' DE.

2D

Ceatif DE
fuon dietònay (valuea- latfnda
ineley autematically gencaeted

ineley value

de

whee nne olctipáàsiea hcse no

Inne Aictosasits
dtionails, wale

d3

Cdde,d)
Dale
P. No

5cestin,adee jane dicti had


been dotal nunke
equal to
inne ditionaieas
()fo a cey that has
Gteetig df fa list etflit athit
iones dictiuaies Vadee NaN asould
weeolto defeict the ualuea
Ex
di= (1:J0 2 204. dit weitb
d2 = 11:lo0, 3 30 dissinilas kyo
d3= a ' ' ; d b : d24

a 'b
nonmatehing
Cnclex inneutey
100 lictionaies
2 20 NaN
3 Na
-NoaN ualues adledfor
non
fnae idienases
Date

Expt. No Page No.


21C1eatang De chom liet s DictinaikD
nne dud keyo tidl kecome col
innt dct valuea will make
Ex:npsst pandar an
AiSno:1 Name: 'Asi 'Manks' : 201
d2=Sno':2 'Name' :Ami! 'Masei 193
d=Ldl, d2]
dt pd. Datafsameld)

Sno Name Mauks


-Avi 20 íone walues dt-es
1 2 Ani
Default tndexes ane
A4te peikgingindex labely trougb indler
agment Lontainig dekels.
L dfpol Datatrane ld, indes = C'SeA''Ge B )
Sno Name Mauke
See A Avi 20

Sec B 2 Ani

2-2 liat list


eah inne liat eill

Ex: ifot andlas


e s L ), 2, 3], C4, 5,63]
dt=d. Dafafame (ei) Teachar's Signature
1
dutautt names ), colaU
1 4 inalexes oe O,1 2

d4 pd. Data fhrame lli, ndex - C'hows', 'soo2'3,


columna L'zores', zoe2zae )

ROne 2 20ne3
2
4 5

heating
a 2D
Nunty Asoay Chaung ahafe as
-to Df) (sn>n))
npars = np. aay (CCi,2,3], C4,5,6JJ , np.it32)
df = pd. Datafane Cnpas)
1 2
1

4 5

# A4e apecckying inderes columne.


d! = fd. Datafsame npasl , nlex =CA ,B], colunme =
Cirt 'Second', Thias)
Second Thisd
2 3

4
Dale

Tapt No. Page No.

each Jo di
be conatleued as

nashi = nf.ashay LLC,2], C34,51, (6,1,8.9]])


2val 2 val 4 val.

Paay Cliet (C,21), liet(C3,4,5]), liot[L6, 7, 8.91),

dt= pd. Dataframe (npasa 1)

1 L3,4,5]
2 Ce,7, 8,9]
DE 2D Dict. with valea as
Seriea.
Sno = bd. Sesies (Cl 2, 3])
name = þd. Series lI'Ai Ami, Bumty 'I)
d= SNO: Sno 'NAmE': namey
dt = d. Datatammeld
SNO NAME

1 Ami
2

Teachers Signature
SNO NhmE
Avi
2
2

dhneno = pd. Datafame (dy)


SNO

2
Ani
2 3

in dt aleo , i you want to mke a 1ue Copy


(totally ulinked neo coy) wae cg- Taue)
ds nen t pd. Dataframe dy, coty Tue)
SNO NAmE
Aun
2
Ari

You might also like