0% found this document useful (0 votes)
13 views24 pages

Pandas-1 IP 12th

The document appears to be a disorganized collection of notes or code snippets related to data analysis and manipulation using Python libraries like Pandas. It includes references to data handling techniques, data types, and various functions for analyzing datasets. However, the content is fragmented and lacks coherent structure, making it difficult to extract specific insights.

Uploaded by

suryanshk802
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)
13 views24 pages

Pandas-1 IP 12th

The document appears to be a disorganized collection of notes or code snippets related to data analysis and manipulation using Python libraries like Pandas. It includes references to data handling techniques, data types, and various functions for analyzing datasets. However, the content is fragmented and lacks coherent structure, making it difficult to extract specific insights.

Uploaded by

suryanshk802
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/ 24

analyie?

Numsuexa
baed dath
(Payaloa Data scuence
Data
mdata Pandasopialiend
arabhantainaeDala
antiyace i dala
Raw ’
ane Dala Dala
Tand Dala
analy
dalaand blottid
Chenssuee
in
HebugnGus
nalyes
dlata
data O wtichdlennt Waehuse Dala Meaningldata Daa
abula
mat
dataet fonda
bxid Handling
iilouai
Tocl
data
hgh ung
iualiealon ,
-puumana, then analyDala
farndas-I
cenetd
)
be
(ntqlat,
olnns A
inled Can
sead
eay iaiaonDala
Featine
Pandas dala
aaed
and n
Pondayaliung
wute
deletid in
can be
maddeubli"ete
datadluctu , abuuctesdata
n dala

uavchaue,

Can
I1dese Dala
.
Ceatng
380 w o Senies
WAP strtee
60 50 One-duneneral Sye
eDala s DS
othrmutable
to an can
mbent
andas ceeae embty Tndex
ata
'DAx30 May feb dataalao in
an Data
28
aiign
typea Panda
3| 31
an
Seies
indexolua Hardling

apial's eung
2:
fandaa
Puo-dunndienal Dalaame -
P ns p I
IndeXes
axu(aeu/olumni)
Labeled Hetsgeneusdala
9 6 8
Output
n-een This mutable
2 may
bie
cenulle
wil 9 D

be
bunid ralues nunbu
Guaing
menthsJan
d impet þunt(s1) imtet Synlari
punt
(s1)Seeies daySL

bandas þandas SI Sueding a


dees <Sues
28, 3 as andas -Chyc
as
Feb'Max td bd
data
dyerent
ltiuoti SexiesClo,20,
30,31J ng Axgumenta
Sexies
Handung
untTal
h a. g
tuo fandar
mehths)
ndea = ttgendalaas
diguunt
hhae
inde as
dajatet
unde
30, siesdala
4o])
40J)
Dtenaig
lisi
Pandas-I
2

30 20 10 dha na undes
typedalDala Nunty
Arwxay
y nda
Dala Quthut ngt

Feb Jn
3) RES
nathemalical ide)a
Nan3T wcala
TART
31 30 28
C7USY
Oust cBnlant
|
exbseon

vale
unelion
-
WAPto
9. aeeles
Cxeale .
cimaout
tanda unpeut
3 2 =
Aein(sti)Slumbeut þent(st)
75 20
6 foSeridcueatia
O pandas pandas
acees
þeint ( aeesa
xange bd udng

2C(sa.
3 RESTART: (220, uth ange
75 ange
Ontage
ralesase Omethod
4),ndes
ConythteHo
cd t
and

o
=x By
d
ef
TARTclweyRES (:
RESTART:C|Uul
4 3
I8 2 ox 3
nt64
in dala
'abedel)
Hangemthscl
name
NamingSeeie a
SrART:C:/y..Feb
Jan
Name Apt Mar MONTH jndenam
=Menth Sl
nameSl" SI þant(S)Ampet
xunt(s) SI
= =
ys, i pd.
30 þandasd
3128 3|
Senies Seee
type
(1Jan3eb' a
int name
andues
Jan
pd
64
o Duienasem
the 31,'b:
tuo
28
namelo colmnd,
namg fnam# 28,'Man3'Ab'
Mar

3 index
diel
inde
the
Apy ond
nan :30
30f values
)

28
C:U|· Jon3I
dge: in64
t Mo3IebRESTART:
a
Seus

ueng
),) (s[b1)
t( þunt Lmbat
S2
þunt þunt(s2['d)
(s2(la','c'
'o1)
hunt þrint(s1) mpWAP bnt(st) SI mbet WAP
= o =þd to
þd
pandad ceai ceale
bandaas
bd
Seiel Dalaem Seues ande
a oseied
(Cio,20,30,4o, a ses ([5,
bd as
a 5:4, pd
sexies wth ming
tungalen
n
6o]ndex eajlucily
wth NaN,-34:5)
poalion
dunad

'a
C inden
RESTART:
ClUuel:
50 30
b,
de , alues

3 2

-345 5-4
NaN 7-5

5 b RESTARI:
</Uol2
2
8

5 4 3
d t b C
b2 locc) duneim
Tadeng
:cUanl
RESTARI Slocl13
þunt4])
2 3 S=foSs
þuntmpetþandas
y 3 þd
as
làcC)it
(5-
loc name
(lI,2,3,4,5]
['b':'e undes
and
iu
wad
'}) Joc['b:S.
'e
eln
erndeng
indx
nding
nom
=l'a
0Hdeleeing
tt
b
ae
de bauud
baded
narme-bas2d
oabl- ta
om
þeaen
þoaLlierwe
n
nan
-baud
ue
undexing have
badundng hare
~o
o
impont
Sz Cealingawecieom Scalas
þd. hrut
Sl (sl) Sl=
banda Sl=
mbet pint(SI) het
Sexies
fandas a þdseis =þdseHLeA aseieA
Soia handas
('Inyenmalus
a uth (lo ( (55, a
td E5, fd
inde nden
PBraiees ndex nden
=[la',5'd,e
abae
sina Lo,2,3]
Nelusk Pardas
RESTART:
C/Uey.

ndax
ardas'st ybe
ius
u
matics
racticy
Inyomalies
Prares
nemales
Pracces

NelseL O65 e55 RESTART:


CUyl
3652
65 65 5555 55

Dalabae
umbent ceealiWAPlo
Caxpenentialien-Aquae Caatiga
dahy Sl=
sebj impet
unt(si) unts) mhet
= =
axane
þd-Ses( þandas a jd np
Seies
þandas
gnat
n pal
(nde
index wiesa a
(o,5)l15)o, thuot
d a
=sL, mathumalical
unelion
thnagh =
the sI Malhumalical
Ehosden
/Funlen
dala elemeni daa
mathumalicol
= =
esaponunt S) mathumalical
Sl expsen a
** k4)
2

T2 loCio 12
RESTART:/uey
I C intde3.14 T312 RESTART:c)
Clo
169 744 loo nt32 52 48 I
2 121 4]
12
13 12
13 yh
T4J
AtiibuliA We
Sene canSeis
Chect CKaaling
Abubei
<Jeed
chyect sIdees
funt(s) Sl=dseuies(anay imbot geneualewWAPlo
cemmmn mpot
anda þxuntCs)
a
pspeulies
yanious
ebtaun
nmpy seissnga
attuble
n
anay p
a
asay(Cio,20, a
(astayl, nSuies
( n
Hlatd Cio,
CLio,20,3o,
index 20, ing
tode 30, humby 30,
=['a, 4o]) 40])40])
b,d') awxay
theeygh
nunty
and
ao
ge
i
aiesuaid undice
dyp:nt32 d RESTART:
ueeyl C 3
RESTART
CJUunl
30 20 20
40
aeoalao
attibuis
(xangel,15,3),inlex
buntndim)
(u irdex (s
imsut hasnand
pandaasSexiesEnmag
WAP Seies Secic Seus.shabe
ndin
Seies
Sexiye
þtunt(u puunt bnt þiat Senies
nhye. Atribli-Nae
Seies
nleuSeie.
(snt
.
( o
(ishape) yale lalalaihe
ndex
timga) nbya)

raLe

Rellans
Relinns
tue Relusn
th Rellun
Rellsnsluple ndasaLy
Retns
Relwns
ndenthe
Retnns Relins Deaciplion
attuibulu
humby the
the numbu dfpe
= nunbe
[ ge a
celatad theeQHe e
cbjeet
qthe
fox
elemint
the byis ahape
e
x to dgedumnlen
in q othe
a ndg
abcde'9 unduyng
wndnbyg
8 (6,)5 RESTART
Cyl NaN

dala
data dala
S3=d the
. haadO-n Sis
iu([2,22,23,24])
a4)
þunt pxunt(S+s)
psunt s2= sl= athemalltal
LWAP þunt( Seies
ndex þeintlsenislhead (2))
(ieniesl)deesl
punt JAP Reti
dSeus([L2,13,4) pd = o nunbe
(a seoies
llsbrala to mbe tail
t denis =
J3) pdSeielCio20,30,40l allusliala O- valeed
Cheralior ete4
([21,22,23,24]
l- þaxametan
displaythe
the
ail
weking cm (2)) the
he
aseed wetkung te
to tot
lo2,l03,o,
104])lndex last
the 5
mathumalical
numbu 5 wng
=L elementa H
lor, ndeshead) Q
data
daéã heod)
lo2, n'
chexatsa =la by
I03, and ales i
bd difault and
104) the
Tail
o ees toil
bebulld
O.C Houene
tem
dbe nt
64 RESTART:
b
b20
out a
30 403020

C:jUyl. badcan fandas


enm
.
Ste Chuct
.
þuntA*A)
bint (a/zt) 83
Iol 2| fo lo
21
2 22 22 to2
2 12 2.3 I03 23
3
3 l03
3 24 to+ 24
dyde: unt64 d e:ht64

231
32
34 -264
36 299
38 336
ints4 daße iint64
NoN ( 523
NaN
O5 454
St53
2 NaN
Na
3 O56521I ss!
O58333
NaN
lo2 NaN
to3
NaN

4 NaN
Axilhmalic cÙuHaien n

to dame index, ethasue uill


lol Na N Hesult as NaN(Not a numbex).
S3-54 lo 12-0
T03 13-0
NoN
dbpa nt 64
Vectoy eexalier Seied
Any cealieni which Lan be eath and esy elarnant
S>*3
>8 3
T3 33
Falue 36
Fale 2 2 39
2 13 2 False 16 3 42
4 3 dtye: intG4
: boel

k *2
121
vetr soratton, a |Q00000
2 169 1·414214
196
3 elernent ees 2 t325+
3 2-000000

f"D0000
-4)4214
Rstsuiung alus uuing corditioms sfz 2 73205|

seresobyet <conditien] 3 2-000000

s= jd. sesis([ : ccoo0, i: 414214, 1-73 2051, 2- 00c0001)


þrnt (s)
þint(alaK21)
þurt (a [s=2])
han no
64
iint change
in
4o d (s) bunt
30 (s) þxunt
a'u 20 elermenti Hemeed unth tad Cea diei n#
tad ['a') (labela= dxep SI=S
SI C 'c','d']) ndex
b,C'a,([1o,20,30,40] Sexiu þdS=
20
bd banda
a umhert
40 d
30 C
20 apeutd
emEned abala nde with CAeata
nw A anunment
t to dhu dolted
as lo
beelement the index
)nathod
by
þaung dsesplathod
by udung Soues em
a element
element an dulet We
the Delilincang
elemnti
Latapamne
Dalayrame u a 2- dnenLenal data utbuutie haring Hous and clunns It an
atoe 2D hetinggenesus data
The basie teati datarame ae:

Columns can be q dilgenent tybs ie. umeuc sbing loat elz


21 mulable that, the nunbu HsuY and coluns
can b needed deceaed any ime
3. ane aleo mutabli and can be changed any
It haslabellrd axed lHsus cslumn
5. Axithmele oexaliend can be þeyormad
Inders may cenatth numbed, alaungs
A
tbuli aDabame.
Synta Cbaeame-Chyeet Kaliibui name
i: index the indesxs name a theindex cauld be O,,2,3
and o gni Alo, 'Acuguntt IP'Eco'

2 column the colmn name

3.
weed o teeh bsth indent and celun namu
4.
ueed o teth the dala ybes ales the itin innthe
dataane
5: Lsd to felch the die the datararne , which isu he pucdut
datarame ,uhich
the nmbe ous and Colund Roo 3, Col4 any-3*4= 12

shabe it numbe elermnt in


a ble fox ex (3,4)
77 ndim usd to tch thu dimensen the gen dataane,hth
it iuLO,2N 3.

8.
it ges s dhe beslean Quthut in the
us tethen a dala<ama has any emply at meing ale
9 ianaC) t check the busene g NaNs (net aumbix

Ceunt it guea the c n t . the iami in the daaame By diaut.


it the csnt the HAs
We can set the
the cAnt Clumnd
tor diaayng
1|.
I(Aansbae) - wd to Iuanpsse the dataanme i
ond colun become Hews
umþoxt þanda1 a bo
dict =2018': [85:4, 882,80 3,79-o], '2ot9: 77-9, 80-5,78:6, 762,
'2020' : [es5,900,77:5, Bo-5])
dy - pol. Datafxama (duit, ndea -[' Ausnta'IP'Eco','Eng)
þuntl d ndea
pintldskumn)
bunt (a axes)
pint la dypa)
þunt (aye) Jhdoe ('2a8', '2019''20201, dyte ='coyiut)
pruntla ndin) Index(['AccauntTe, Eco Eng,dbe =Caect'),
Inden (C'2o18,'2019 '2020, dlpe ='obyect J
pnt ("Fnding lan ")
prunt(dy isac) 2018
2019
2020 ts
12.

4,3)
falue
finding NaN
2018 2014 2020
Accounl falue fale fale
LP Ffalse Falue Falue
Fale false Fali
Eng Falue Falae Falue
o dudblay the count and tuansbse attibuli
9 WAP
Ambeut þanda a bd :l77, &o5, 78:6, 76-2L
diet -£'2018':l854, 88 '2, 80 3, 79 o) 2019'
'2020'865,0:0,77:5, 805Jí
='AcceuntiIpEo'Eng)
d bd atafnama( ouet,ndex Reslat ic:l Ueel ---.
bunt Cd) 20 8 2019 20 20
Acceunt 85:4 77? 865
þint ( ds count (1)) LP 882 805 0-0
þunt(d- countlai 'ndes) Eg
Eco 803
790
78:6
76-2
77:5.
805

punt (dy count (ais =coumn) 2018 4


2019
2020 4
dLybe : n t 64
Aceeunti
LP 3
ECo 3
3
Eng
Aylr tranepooe dtbe
Aceuna Eco 79o
8o3
Eng 2018
2019
2018 854 88·2
805 786 76-2. 2020
2019 779
2020
diype
865 9o-0 775 805
Acceui 3
3
Eco
Erg 3
Geealion Dataame and diublay
Colnn nme
(Name Mark GHade)
80 BI

Rahl 92 A2 .
Indee C
67
Dabat
2
Meghna
Radhuka 95 Al

Datafxama can be ceealid wth the

’SeiesA
"Diienay
tmbly Daca Fxarne Reslaat: C3/Ueer/.
Cxaaling an

impet þanda ae pd Empy DalaFane


Cotuu:t
d =pd. Dataframel) IndexC]
prunt ldy)
2:
Cuasing.
umpst pandas as jd 2
lo
20
30
ist) [1o,20,30 40,50]
dl=pd batafranellitl) 50

þiunt (dyi)
Guealii Dataf>rames om
nbert þanda au pd Reslat:C:/Uerle-.
Name
odatal - Ct'shueya' 2a, C' Rakuhit, 22), [' Sijan, laJJ Shya
Rabsht
2
22

d l =d . Datafame (data l, colum = ['Nama'Age) 2


Sjan

4. cealing Datafxame om Seiss


impet anda a þa
S-maxks =þd Sei ( 'Viaya': 80, Rahul':92,'Msghna' i67)
-age = pdSeis ({ Vyaya :3 2 Rahul':28, 'Mehna:30 30{)

brint (-dy) Reslant:C:/Ueyl. -

80 32
5.
xealng Dalafxama fem Dcliemany Rah 42 28
Diienasied can be þasud as an nbut data to cuata
ate
ghna 67 30
tetakenau
datauame Tha dielionag
Calumn nomu Thu ditent way to cuala a dabigiamwaing
a) Dailienany t
dieiarant
c) List cuienanus
a) Guualing a Datajxamu ung dclieay a iat
umpet bandan as hd
Ahdant =f 'Name': ['Runku 'Rite', 'Ajay', 'Pankaj','Aditya',
'Englih' :LG7, 78, 75,88, 92] RESTART d Uenl.
'Eco' :[78,67, 8A,90,56], Nane Eco IP Aeunt
'IP' : [78, 88,98,90,87], D Rinku 67 78 78 77

'Acsune' : 1,70,80,67,&? Ria 78 61 88 70

d d. Datafama (utdent) 2 Aay


33 Pankoy
75 89 98 80
90 67
þrunt (d) 4
88
Adiya 92 56 87

imbet bandai a bd RESTAKI :C:/ueyl..


mbet numby a np Name En Eca IP
Sesc'Rnku',
bd- Sual ('Runku' 'DDeap
ecb', 'shauya', 'Rodhika' 1) O Rinku
Deap
84 89 89
78 78
73 78
2
eco þd Seris (l89, 78, 67,9o]) 89 G7 60
IP =hd Seniesl 89,78, 6o,98]) 3 Rachika 9o 90 98

'Eco' eco, Ip': IP

d = pd otafxame (stdeult)
Eramble 2
npeut pandas a bd
stud-slt =1 Nae Radhita'
Eng'i d Seiea (C89,78, 81, 9o]),
'Eoihol e s (l8,80,60, &4]),
'EcD RESTART C ! / l
IP' d Sesies (C89, 18 ,67, ol) Eng Eco IP
Name
Eng
89 87 89
Des 80 789
bnt (ay) 2
Shauya
78

89 678
3 Radhika 84

4. acaling a Dataf:arne ding liut defiraies


umbort pandas a bd
netident =[s'Runku' is7 Ria':18, 'Arey':42,'Pankai' : 88
£'Rinku :77 'Rih' :58, 'Ayay87 Pany :65i
i87 , 'Panka
'Runku 89, 'Ajay61, 'Fankaj':74 i
pd DataFrama (nwatudent) RESTART !C/UAHli
ned) Runku Rati
þxuntCnaudy) 92-0
Panay
88 67 78
81 65 17 58
67 74 88 NaN
2.
5. Ceualing a Dataama udirng Numy ndosoay
umbet pandar a
[a1, 78,75,88), (18,67,89, 961,[78, 88, 18, 9o)
a y nbaay (L1,78, 75,181,
Accsunta'
Colun-ales = Eng', Eco,'IP column
Dalafame(dala =
= colnn-nales)
d pd.
Eco IP Accaunti
Eng
67 18 75 78
78 75 88
2 78 89
3 78 88 98

Dalayame
Adtinglaitgg <dalajxameohet lo lunden ] = laul, vala 2 , ]
umpert bandos au hd 'c'], Eng': [ho,50, bo),'Malhe':[55,65,75)f
sudant I{Nena' :[A 'B'
d d Daafran(student) Mathe
Nam Eng
punt ldy) A
Eng 55
50 65
2. C 60 75
3 65 70

You might also like