0 ratings0% found this document useful (0 votes) 89 views35 pagesPython Note PDF
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
pen PasaScriny
and book
Mod
Srtroduct?on +o NumeY
ae
» wumP. ®- C Short = umerPcal Python)
5 prove eygresent Mrgerfar Fo StOse 8 operate on
dense dodd buffers «
oH Provids much more ey fides SHOOK
4
import numey | . frnpott numpy 4 a
—
numPd + --versfon
£ ‘\oaleb
) > ton crease dist re gadegers”
fF enbd 2 Ls lest Crane cro>)
t
re
Por hiy sores is brat
Gapans tee CL ted)
pur la\: Rod
> prud Type Oneyh
eee aa aney
t= RRs C range CLO yy
= Li Ge geyearayic righ)
swung foral unre
Sadaray ~ a g , e
s geyerat wos 4 croatag Mum y artery
© Fmp ort numed as nP
5 cating Ore? ym python (si
, “ap pedeger ano
nprascoy pews 3D)
numpy Coasieemal Fo arrays
Python LfstySx~ {post numpy ay np
a= np-.awey CL4,a, 1, 3))
0
dps ano CES ta's ‘11 ig fad
> 4 we wont fo explictly Seb dat tdPe a reulting
ano
npeartod CE a.R4 1, atyee =! fleet 32!)
i fonod Sore
& port ne a 4 7
Nes ond Gene cf 4) for 7 in co 34D
Cy, Coluans
crea prays rom Revackh
np ZUG CVO adiuee= tnd )
ofp. QWay CO, 0,0, 0,0; 0,070 ,0,01)
+) ne. One
Sno Qeange C0, 20,2)
ofp? array CLO, 6,8, 10, [2r1G,'6,1F])
> rips iPraspur CO, 5) . vate wtth of2
Sradng Ss
op avo (£0 -, 08, “05 ores, 1, J
Jom « vardom (€ 3,3) ))
=) npr ra
Snr? random onormalCoyi , ¢ 343 ))
t
mean4 © YANKOM - y o a
De ards (04 1063,3))
pnpeedt 3)
ot empry €3) > displays Yecnk valu Fr numa:
ees oh a
Bisse hry anti 008 shape moony
—“tmpsurnplin 2 doveatypes @f ancy’
ra a.rrorp: Quthg & gesting vad out
Pedhveducd ave} Eldninds
moller
ors) Sp ano: gets 2 seaging 8
‘4 gubasrays uotthn osge os
pot numpy @ np
ap: random * sud(o)
tis np. vandlom - yand Pad ©, Slee =o)
xt :
Kuve 33 3 13d.
xg np- random wyeund tad 13 aT 2€ 992d)
ay (TE toed,
. teed),
Etaed
£213 4))
4 iments)
gfe eath obimen 3 Pan)
yas gree oY HE OMY
ie 3 sndiim )
1 eas shore)
30872¢ >Grass 2h]
PD) raniery 1207212)
waecop{ =f te > |
L + 6 |
1
| se want
mae cory £0.04
ie |
+0
fe Chourge (6
af fa
So
xa_« OPH = 22 ee
oa va. ord 2 copy l
ee ua =
=f 6
4 {o,o) = 41
]
1 au
ua
fie eee OT
; :
J por oe PY
5a ieee i 6.4
46 & & eon nacdit get Ut
44
2)
5a Paiitco oht= 0p aren Crangt C2)
ane CL % Se
, a rang Crary cay) yeshap® ae
aan? fa 8 ore)
ule t-
ra ar 34)
Loree ad
w |
aArray Concatenas®ora curd splittiog 5° _
SEnpat se 2 npn FEL S38
Ye qpraway CL 3y ar!
Z=[17,17,71]
pred CnP+ contasercd? C
Lrasaal qa 1 17 J
coun oelso used fot
pay2d))
nP- contodenate a-b ane
ed = apraray cE cred,
grt
[uy s6 JD)
‘ : nprconcatemas e (gras gtd)
ants 0% “Perte aati
210 nu 4
os ths ABreetfor oulorg ths woes
pattie Leiner!
Hood cot'*€ allen
6 8s fa MUS goad runs clowndassnro!
peel (cen 31,Bee ner end CLT 3 offs ang EV 2.35
aifdanPeanoy C6 4. p 43) £7,3,37),
féw 43). Cos43])
NPs vsiaek Cla. grfds )
qenpeenaey (L991, oles anoy (FL 8, Ff,
: fetIJ) rés,4 1D
AP+ Stack ¢ Cod. 47)
ook — vertfea} Staci +
pack ~ horfzengal Stack -
pork rwemey
e
npeorey CE rgd, koh D
¥ >
gplft Carrs 4
. f anoy iis}
a ep auad crete D, mi 5
6lf
| arey ({t nd,
p4,a,34 | cud
CEP a3) Can
Lusi 6 1, od
Ceti os
ce)
way CE £23
aed Esa
c83,
1,
cd,
cia)
array (£03),
q 6],
CI,
[193,
cs),
sy) ,)
tage
farey (f ee(h spud) & hevackKO'e sh S¥arck!)) ~~ Aww
Competedion on Cunyy arrays,”
ree ees See
universal functPor qalud Cufancs ) Ruy 40
mote @+ fast 4s fo ase Tectovized operations .
Steps.
pL mundadion does
“yy Blown of , Looe PYthon'? Arfeuuth ey
Bort operetta, VOM low ly
tn pau duu te dagnaraC,
vpdenPreied nacure of
jong °
fat od
> fact that “lyre
ok wareg nuUMpY »
=> python 7 Slow fo ot
oo es ee TE
j
Tatredu Ufanes e jelrles
D4 ear yyPe ef eperaafind , Rampy proveden a Conventtad
Grderfau bade gust tos Iciinck 4 aig Fecutly dyped Cvodabl
recht def Ted.
JypU ous exp
> Known vector foe operat han
prottng ble a away &
ype armngs CS? [npecsange Ct, 6)
npeartarty £7)« sedhope (0-313)
ee % el —
CEE, Bad,
[ 9, 1638),
|
GHEE) a=
a
ofp <*Tee type cheuefrog Fr wil eer take sient
= jue flavour 3-
yen usunes
ot
2 a ee aaa
Foner aveng lu) q = oft
Beene 22) \ x2 L012 3)
Pre (xis = 1S) ee eee
Q (ous 4-8) feb |xcS = Ss an
KA>L0 a rea)
a CL RQ? KD)
L1dz foros ns]
C*xfa=", x12)
| xila= boot! J
(ella a afla> U
floor ait ge
re *s vfunc’ for migation
— exponentfad?an
xe
eal)
ad)
Peaviuce: t pprabsotute :
245 ee
Fie) a=) Bur
a2 y DE
32a ue = yqele = aS =. [spilex
{valet +
ge] oar | > magniiee
J
Lirrgpac s F
- Oa + generate dit number Ha equed Propovtz, +
ad ac a
Pac aiad =o , grop= (oo, num=8)
"e PS rai
> Jes] so 4 oo
np» Daupacte: ) fie &
nes Berae \ G npearcstal?
ner fault? nprar cess ( )
npearctan ( )
nprex PC) Capone
OP expac-2
AP+ Power Cd» * 4
Bed pier Tourn Geka BamNION Fe
Beticprercanfune est e'% Gedutt attend ee
4 e ep rite Lompuladin,
ee oF npearangees:) t tt ‘eng = .
“yo npremPty(s)
npr murhe Ly C% > 10, ot =4 )
U
if cevrep vFews
C osit
ros C19) ton werte rout
Ls out <4 Eee \ 4 computedten fo
j avany Otel elemund
S, a Ug gpectffedl anouy-
10, 16,0]oe
aang C
1,6
op add - veducrCx) — oe -
uitng vecluee
a duce on mutiirly ufune product
aperaul fpby -veduetx) — off eluaue als
ie Sadermedtake Ccles
aad - aecumulate Ca)
Bp aro CL aS fH .
Bate gon eattwrutate C20)
ale aura 6.9 )
ee
a f lem gs a given
oer
are weap numey «
Brow to Sort fa eferncer as
When cLmay Lar
¢ Y wkke Luinpey
tha mruan oh every 7
fh every nun py cuveey
gx" did oud
a tht grven Ps
eye: 2 31,
de np avangs C range C40)
67.8.9. \
es aurrany ( Pro
| Ve Ife ar ancy € veurngy
2:3, :CC
2 =nPeavange Ct, ¢ ) 9|if23 /
p>
i Odd + vedere Cx ) veduding tat atime
lp 15 woo
pein & mort
Deon © sired diviaen
D8um, Preduct.
Tpke tk ~ dled te dfiploy me ( shoutd Sraport )
or ae SUM Several ofr NUmupy agyupas
& Shocler Snsax ¢ Li of 6 :
cuncey i, T4Self ; ae ae g ~
> Ped Cbig_arayemin (>, big-onoy mane Lo
Wy anays game ))
+ Seotth man and mtn tn a given are wsGne
d
pane] “
Ampere ‘numey ay. np
Wat 1,899) Cra. 3616% J, C9567, 207)
; phe ner any ca) . sy pas cld
pitas (Demand) pred CP mae”,
prod Che mined)
fe maxi 5)
peta Crate’ Bemilats) |
pax,
shop 63/3)
5
aan i
(b= -apterrte pats
CLraxtszo ,
pe Sort th)
*) pear Crete tbo ax
pity (a)pee Co ratiton ui = 4 apendact) )
en ae maatin ur =
“y npemax (i) )
Bere Co Dede] mmm volt +, npeard)
Co food F max yatur oy»
ecnbe sort CL, ated even) + rarer L033)
cre gort (4, ax%=f))
gort CQ, a2ers =0))
amey array tath
ay find the ten sof ever
hist?
jcdal vows @ colunnnt fa Mumapy erred ?
re Nunapy 2 *P -
[03284 [ride], (83 5 12 $7 1]
Fay enrrawed C24 Tee -
Arey = nee ygtack ¢ carey 4 niweow ) J
pean: CAT )
E mumpy erayy +
yar
of elemen
eyitn each
Wo pruetved but
Le eulony cdCompuicdfon en Areaijt !
Srlumpy unhvertal fees aru
eperagtom’s & FRarepy remev
y
fon be eaed 4 ypehenee
£ Ylow Python -
|
Lyte Jono ufancs
for opel 3, Ge pectormd on
tho
| Broadtcst¥ay 2 gy ¢ calu
ofrativm’
> broadens ting atlow! biaamy
axeup of abs 3.
]
| Average hafghs of Ul presicunt4
anport. parol rd
dota > pds vad.csy C \
pagnid enpramay (date [high \
paca boli
eG
7S vocnpvehenaln debra for creaking mews aaah
Rsesinive vtsuatszation gu P4Yaon
geaborn
Fader Comm ued -
paaaprorsse 4 8
a qreeh
siatole Ket +
Bd coton’s ON
éy thab>
¢ byeackcos ng i
4 creo Jakes ples,
eaborn
vg um?
Food tn g vot clots. 0°a -O+S '
|p arey CCS F)) . i
Acar ACs velit & tato the away cssis]
pa Ma APs OMS (03,3) i
A :
awoy CL \+, Wey
a Eta leelt Ue Ble belly
a Fs Sfreketod
acangy (3) y
rang tay¢: japrriccorts)
boa) E ota \
{te3
ti
913)
pa dy peasy 24 I)
fev. rs 0
wir Avmwutyy Hs addeol wth
fag C Lyf) Stel,
douny moth any imras ga
@ cqued fo L Ya shad Gmninsiny
he otter Shape
Mu dbsagru- £ vd dheNEE OE
CAT. - foo oD arcuy 4 t-Darrry
Me nheOnth (2,30) | ome | \
A= nPearange 3) : (a3)
Shope ef anays av. s
{ 4 | al
MeShapt =C2)3) Eos
a-shapt=03,)
f Rue) me 62137
> auts } az
Meshapt > (ad una mz 62>
ae Shape S013) 22.2)
i vy E ol? |
“Pi | ais | ae
me ago Sharl= (3.2)
ae shape = C35) p- fot ad
Meghopl D032) as C3) Rubol3,!
IgeshapeDCt,3) LSE 8) 9 Oh3
ns Rugs a S032)
5312) b3C3,3).
3? Rules ¢ does nod modch
Io
25 do not aaa J RG]
Figo cuviays
a FI
eee Gree -'
aenpeacang (3)
ig (2
pity (mba) > ve
Se L
Corns UP woheen UO
raansp uote
Se
Dour edgar wi SP
at Cormpeuts
Pers CE ty RF’ 1)
> als ey
conap (] Trap, Tee Falher, False salse | atyr!
Bey 2-02 Ft))
is alee, TUR | Fakes , False galse. }
a,
: |
a
as) aa
ee 7d J
# how many valle dos flan 67 :
Sate cound nonzere C%<é ee
: qoi— (1<é)
Pa = 54 dow ve
\ear
Sr 7 8
} qe x —
-> - npr Sum (x6) {s 6 BJ TT)
+ TT
ae - & [eq 2 si[=[Fers|
pak Fa) } [TTF
a
Ny
iat — Sum(arsd= &
ool = —=
S _- (128
sy nprany ©) MPrall CF |
nprangex S9) neeart (<1)
ofp — Te, Epler
np roll (t<8, awit = )
x peal (L==6>
ofp - False sp [Tus Feb
oclean vette? [ 2, |, A ant 1]. Joaee
oe “pehatse lag heal apacdes
(£74~ neesam CCPaukes So-s D2 Crack <1)
Sx6 a=i0
b=16 re by
PAs (Ak eid ieit
a
| b 8
aig pe ido
5 ‘
b 2
fuAN
Lager a
fsaut! i
, UE a ¥
noinul! —¢| [
C) ow too W tpes (oba« Fsnunre ) ;
Pefad Coba + nofnekbd > )
Pring (Pde tenutiCoba >)
5 1°,
pin OPEvasrOny *
> obs names ~ PoP
: cele
Ge Snel name = "Siase
To ord
ay ye fast aes
dt 04h
Pobeararrars (dad MeL
a ——————@ framea (‘give’) ot
SS fama. doc [
SD 4fo veirfeve 1 volt
bees: PE itFng Be mbsctvg vatlus
Pramed Pldeti') = 16S
> fraud r “eas
SS framug
dal method used te remove
dial framed [ eastern’)
: framt Qe Columns
])) SRi- codes.
‘
usted
fop= f‘wevada & i #0 “u
“ohfo': Za a Mt
We nevada oh? ler
W000 geen
400! sate ae oY
Le a4
qertuidy Ratarrame car by Arch ihe
framed:
td ‘d T fs Trenspere -
To change Hx orclr fee, Fie 4.
Cotemn or colttmn to wow .
Tidex byes pando’s
> resporathle for heldiing Hu aaxfs labile 2 offer my,
> Any array} or ether Sequencer of Labels ch Use ushsn Lo i
O Serr 6% Bayaframe Is Wernatly Conurted to an Tog,”
(bb pl—Sertecd
chuplPcou € re
PAG ose
» dup fob tds Inde ( ['teo', | ep re das "tos"] )
41 > tonvate = $0u
obp3= gd Sevu C CD btw! ; Couph!, \gatea!],
Gaux = fo,a,Ul )
obss.
ole’.
a pave apurpls yellow -
akg d «vender Cran (6) muthock = teerul)
ofP s- © blue 4bwe Q pure 3 pure: hy Yelloes
ss yellow
Aryre +
Se
obs ect
— ov: droed ‘e')>
lon be clelitedl from efter O77% =
Spc Hols
PeAee vaiur 8 Cofumn
fet )
a. drop ( ‘4wo 7 AUS = 1)
Bedvtieg » Selection
obs = Pd: Qexfea Cres
eby
same c\..0:1,
and Fillectay Sx
——J °
fadtxX =
arrancys ( 4) ?
pe UES-
Ae fu ; J 2S
obj
am 00
bs:
pee 0
ese Osat ftopel € Lood
> inegers CP hoc )
t
= + doda shoe ['cwlorade 3 JL 'te0', "“Lhres J
fon with doc and 7Le¢ 7100 3 7
bee
7 twos
ont two 4
thre ¢
hf o © l 93
lode Qo
Web = 4 7,
> dota foe C2, £3,0,11] mer Ei 12 IR
olf» “ a
Leah, log q
data Loe Nee “blah! Yooo! ]
rr '
Colereds 5
utah 4g sere -s
reshape Beam
aa =
| ppercslons blw Dataframe
—
fans pd EB ‘yyah |) oh?SerPRr Pd.
‘i
frame + Pert d
. 5 0
> ey
Lt a
typ: @nt OM,
* '
t e f
© > 6
broddtcone fect
Seatenw > gub Cgerie
Bre.go7"\
i
ores Cramp (3) trex =f
Sram
B,axfs > ‘enclx *)
)
4 Sertesa.Fanti Apelfc
= ea J
pd -Padakrany (Pb—ancken fires np.
arange cia): ebhape (41 8) » Coltumng=
agst C! bde') 5 fackx [ ‘vias’, ‘el
Vovegen'1)
Pita C frame )
frames
te haamboho XIX ge maxty-x- mht)
Frama oop ply Ca )
of =
We de é
btob ° 12 arn
ohto zB ge Si
Tow \¢ Ze
Oregon 4 Jo Ww
b ie?
{
a
c —
i 14 apesy 8 net atasery
Beucn pa-Sertu C [xemincig e+ mB )] ;
padace = [ 'ywta!, 'mae’ 1)
ap rly ( Pears =" Cplumns
mon =
2
ESt «
Pemred = amndoe 20 eE”
Sositag and Routing =
ust Sor -Padix rauthed cuebich webu a rw,
Sorsed thy
pa- sertes Cromgl CH # fein ee ia 1 “ey
°
ob;
obs e Sort tadex CD : ag ;
Prams pd. Borer Cape arany (2). Veskap (Os usp
cata = iti |, Tend! Dieter
Prot [ a
[ a ab 5S
- | Jae o 1 23
| ow uw S 6 +
pit ade Cotes * Sort Fal) )
aAabe
ons SF
{| Ree o ft Beaan
90,4 35
ad | et
seek
ye ob)
so! @ €9S |
i \
im tor
|? |
\ 3 ues |
u BO |
5 deo |
bx heat> has cenolings 2 let | Jaulilas |
Ob} « rank —— = Faloe Grethock= max')
“apes vals -
a EET hy ;
Pe
Sra
0%) - [
eat!
Wc ow PHS
é
4 F
AO Roc
\trams = pd- Dota Franw Ce bes Cues F, SQ], 4
Nati ) tata
a eDitetinee Tyse't Dass,
> fam. «
s
@ hy ae
Om fe ore?
yo fo
2 0-30 70
B- | ao “aes
Frome «rank Cots = 'gtuma |)
pars 7 Taoexe WHA BupdRode Lape.
2 whale many paroles fun ( [fhe retndex) repusre
Shot the Jobe be unPqut , Pts not mandetory
> Trausteg adobe cofth mlttede Fd rejany
a Sais -
while ging entrru edo co Scotou valut
> eb Tia! a 6
wu 7
a o b 2
a i 3
2 ike ay A:
Sa a nputtng perceptive Sted fc
> pandas o;'s Centchas 8ur af Commen methine!
Srektrirad mstheds-
a——
adi=ard * Ocuafram CL
Lieu. ne nerds
Lg ves J,
Lnpenan pape nan)
Lows, -f-32),
Fadux = L ‘a’ 'p!, te ‘ys t
e Columns = Prons!, "Yeoo! J)
One jwo
% \euo =~ AN
be pip "Oe
é Nan NAN
d dejs ~h3
Sddegumc>
me Fras
mo -S>80
a ee = Coolurang’ or axis gums ates th
& Phaferd *
Bury Co's = Columns" )wus oe excluded unlus Ot tadere Ste
liane be Asabbl WPth Skipna Pt |
Sess Gun
; sg (cipna= False )
ad de mean Caxh: ‘column’ |
amAN
| b t»300
| c wan
A ~oags-
> dbf idamax¢ ) — tholoc masctuum veg -
| ont
i
| two A
} Sad mete Sui e 5 ena ladon Sum
I) Haag ©
| . One tisg Cetep by Step Bumrmat tan )
Ms Wo A Aw .
b deg tise oe (
; Yeu a ‘
- Cc NAN wan Le a \ Proce
dL Gans) ote VQOd Jetoy o-ys- )
deserve ahaa Tie ea
eve &Y
i si ge SRFecat Pt peadtis
ee. ee "egpi . —_— TY en S
Sdo-maich sede seta fe! sar by ib lel, 'a')
|S owfqut val ed-Séries CC 'c' bh’, bl 3)
I" sp PA+ Lecter ( untae veda) ¢ ged - raclexes€ fo- meer, )
ared(fo, at, 1, 0a] <——
yas
i are Me or
° a=
|
|
|
|
|
o 2 €4
c aw Lb L CS
\\
pe
|
|
weull = data apply ¢ pds valur—countd ) > $2 nary)
||
esuld * Ot & ae
| Oe A |
i] “Od 62 a3 \ eee
| 5
| 8 Me 8 leo 10 a2 7
i \ 0°70 Qo 0 ab 4 \
Qeo 070 a)3 24
| O10 deo ab. 3 4
0 tO
T= 5"' « a
a. 3
oh
4-4