0 ratings 0% found this document useful (0 votes) 2 views 13 pages Advance Python
The document discusses various functions and operations related to the NumPy library in Python, including creating arrays, performing mathematical operations, and manipulating data structures. It highlights the advantages of using NumPy for efficient memory management and computational speed. Additionally, it covers specific functions for statistical analysis, matrix operations, and data manipulation.
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
Go to previous items Go to next items
) Recording “Vie Preaeycamming —-Poindot viets aeinse) to 80. -
See
a
Rosicalhs eo Myon. ation - Tunclior
erui ty +
once class {5 declenmed we con” decleoscecl ON
nunkern of Oblects Loclonging + ko diss
XK. 9- Qunchon)
def _add Cole)
rae elu otk
odd Ca) det
mi
Class ucheme 2 # TS dis
del shou Cet) 8 te skow is Vhe Sunchon ond reo of
QrGal (eto World” ass.
S= exameleC> ‘
Se shou CD
lion iS declesned & class Mans ercale
SeGe Bs
_ pave le\dss) oo Jt
Suet [pando
a ig Yi a |
del sumC ser?) 4 HSeif0 meons Whe value afar
2) | prin CS the Sum is" Pass, a inv) pA fi)
_ob\acdaC) #oblee) dertearakion ey!
Clos SoM) #Manchron callie og with the hel? & object
ss
Fue need oblech ot ie she of Essalion calling in class
ond obseck method»
LEE
ob Be Bday! momen _ausing_olass._erd_ obec\
Closs« HOdc } ; bn
af suing Cself, Ob) ie
= Sel0,Q =O: 2
i Sa b= lou
Tetann self a} Sell lo
Oboi= oda) a
ObJ-suin Clo p10 j j
a “sum (10,5) # tas execubion value... is sti in ose
LJ
Sing ro find _the ee of 0 nunbere ? [aa
Class _orathmelic - .
Pee TE deft "Scpioné Cool.) sonnets _ edn
; : eh DEO £ 12 ‘ish |
relusen | so\fou* sat. OY 079 iz
Qe} —oratareh.c 2
ob\= avathmelic OL) 4 | a_| Numey rary, ‘a4 ft i oii on {
Nunoy divide A Pork Ly Nuwortienl j Lr —
ee eae WW) Python a a
% ney —_woreasty, Js an en Smincd ehthon bilorcouty used
— {ferent onning—swnenc_aud_tattenatinlntnestalion—
—_—ellicienty ] J |
pS Hts surtoksfontange mnulidimen ss antl _Sseseag OFC
inside wilh oO “Collechion of gfe Lascl_maliesalb
___|Bunchion to “overme of - these acy t
Soon FF nung 2s fasten than python sh epause Slones dale
Li OO ConKnw Locahion and poifnrtms Pernt on!
using __eredefined flanctron «
__& MWhat ate the festuxe of nunpy _2_on_Ravantages 2 _
(ik suppoms —_bt-aimensronal _ Arereay,
PEE NES ster Wan chan ts)
| Ww neequines less memory to Shore dogs
|W) 14 erowites oll _tnnthematient _fuinelong
W\ 14 Supponls _Malrelx persion
yh is USCA aka Care Ninof _numy “ound cea
Es mmors So Wogdile tore cmenn, ‘ey
faintest, oncin Slee uonnela oe 2
lopercaliory _wr\h — minimal “cade
‘geicahion. of Nuinpy 0
[by tataseence
WW i
(qn)_Ardificral intehig
(u) Scientific feseanch
\ Peocessing 9 in
(w) Shaki stics
(i) financial Analysi
= fw) dece learning —-finest “we have 40+ 1 to. Inport _
: b Inforct Humey as “ag
— np_i8 the snd naneof tiny —
as Oreo) funchon _3-
|The. area 0) funchon is used to eu a pe
- | from a list , tuple ow othere_slercalsle
| -Sxynhon-_numpy. Oreo Colotect t
Rey _L=[10) 20, 30,40, 50]
O= NP, artreay CL)
prin} (a)
Ayeet) funchion ; eB
unchon in Python 1S te fo. Sind the data ty te
of o ee on oseck =
e Col \
EY _O = He, asececry, [10 29/89,40 50} )
tuse_Co\ FE _numey -ndovercouy
Zeros) Puschon +
We Zeros) Yunchon IS wseck to “create a Winey ann
Pied wilh 9s
Ganlox neeZeress (shave)
ae EX O=0hs Zereoso)
Print (0) Lo. 0. 6, ©: 0. Or 010, 0, |__ We anes) fanclvan is vsed lo erente o “dome, 2
at] (Meds ui 1s i $ ty
| Syntorts_npvones (share) Spone- 226" of Onn, i
| 88\ as ess site us
print (ov a) AIA OT
ome [ke Pull) funchion is Used 10. erento o seg 2
= Aled with a specified value»
am ___Syrirox t= np, full Cshgee, Mlle value).
| ‘ Slee, Paala in_ ink, iMlesie ining >
Rx p=[Link] OS 100) .
Grand (0) # Ti. \00 100 Noe tegh
_Sreange Sunchon 2 ___ ay
‘e “Me GsercongeC Nunclion is ured So erente He SHV |
sunt Values in og Specific meng
___Seynhox j= ne. eoronae stan Sa tes)
BUF ge pp. onsonge Cv tl, 2)
grantor’) AWW 8S EC]
= Unseoce UD) 3- 2
ce Tne Unseace Tunchon is ued bo» erento oun owray
a ist Be Spaced numbers between uo ssecitial_—
ae oot aaa Shoe, Num )
EX = NP. Lingeace Ct, to, 5)
prod (0) eo. $88 LBS AS ae 3
a
e Shor Shank t0-| ot 257
Nuwar of yolue-\ s-T = a mony epreth— Sg
__ | damensnons Caxes) of “une ait aamsb ih |
damenson funclon => neim
The Harm ad itlule fs. uye Vo» Cina Ave imaeh eaten
Syndort tc OsercOy e Ncutn heii ) 7
AR EX )— NUCH VP rorercouy ( 12 )
vee Cost naio) #2 fa
Shape '- 2
|The Shase allmlaule ig used to find tte size of
damensiot\ ol O numey outeny =
Syntow- [Link] i
eee ben 43], C456) 2 OF
pruint by aShoxpe ) #0373)
Size + 5 ;
| ae Wr TS weed Vd Sind the Yotah munnver
of v
SyMJar— _oneroy » SIZE
eke benps vorwgy CLL (23 1, T4506] Casa) 1)
[Link] )
Meshape!) funchon
The reshaeet’) Cunchon ‘is used bo chonge the Shake
mengions) of ing wb dab
Syhortl= onsen: neshage ( Rows» Columns)
ili iain
ERE X=. “oxy LEU tat S ray)
y= ene shave.) 4
oraad CY) # oxscoy CCE 3
i ome donk t.5)16“flatten() Auaclion 3 ae
“Tare MadlenC) Cunchon is used lo Converd a
Mmudti= dimensional _avseriay into _on one-damensionok ane =
_Synton Lean Mloden() a o
7 Oke Geng. annoy C(C121, catnone
| prand_Co.flodtent )) #01234]
om)
[Tre Suml) function as used 10 Pind Vhe_ Sith oe |
all Blemonts _i_@__Qumey_ Gurentary weds |
Syphon b Nes Sum Canenca 84) “4
exntrtoL = Ur aaa ! “bad
EX = np CLio 20, 30,40 ,50 | S
Caled =
prom Pinon Cay) aa % 1507
Mov) funchon 2 L
The _mox() ore npemaxC) funchon ig. Used to Find tke
| Loreqest__ehemedd-_if_o._mumey, aera +
Synlati- 00 ono Cosereay) oe enutay smaxC_)
@x
’ Oe nes orereay C Cite, $0 40,50) rr
“apis att pring (Mowimom 4 “yene-maxCa)) 8
Zz Mint) Qunedson, 7 ‘ Z a
so ne mig) funclon is. ao \o Aina Whe Smallest
ae toe in 0 Numpy i
eee + Synhore NP von Cala) ab ea nara
wee he com hy
OF NP» ory C[10/30, 0, 40,50] ) i—
pra C"vyiqimom +”, 0. tunnel).a
mea.) funchon
-|the_meond). funchon as Used lo Piers se peragy-
of atl elemeds 19 O _ Qumpy Covert +?
Synbarl: NPMeonCoray) Ore esta nea)
EXE oe ne onertoy ( [10 20/30, Uo, 501) Lee
prs C“ Meon =, np. mennlo )) ———
~lecuon C.) Cunchon 4
Pike —eseiont1_fuccten_is_usnd_to_ind the uals
Sportage tas —
O= 00. ormeay ( [10/29) 30, eon ae
prom (“mechon =", no meaanCa)) 30-0
Sort) funchon 2
Tre _Sordt) funchon is vied to sretange the _elenenks
a of Chun MN _ascerching, orden
Santoxt nee Sed 4 BE psertoy, SOW)
“ext Men. (L435) 6)
prantC! Sond in ascending =") [Link]))
tondom() Funchon % !
The reondom Madule tS ‘vse Yo monde PLouNdom Number:
in Humoy b= O
Synhox ie reeongen cond
AP, ONdOM, mondial Clow, high, Size)
Ete O = Ne- mondo recon C5)
rant (0) # tod generale clecimal_nonbere_belweon
0 and}
EH QL Ne. condom, reondind (1 19,5.) #randind generale
ee Feonctom nkeyerepane nung, ~ Oreroy using _tNS _Positian Cindeie) +
pocxing
{indexing 1S “Use” Yo access oo Specitic. Alemens of
Spt. Ergag — a ig
RA oengvoinny [rj 3/5265 * ta
grant COLES _|y
Slice 38>
Slice 1S 4 Used, = access. Keange of clement: feo
& WON Osea, i ) Ane) ' (3 tg
Siynbaxr'= “agurtoyT shasd j Shoe! Rep i 6 a
RHE Qe Ne. array (LN Hy 3/5/61)
ewd Calrs |)
Sime maracs 000 lO Wosieest “gtudbaLe ond Gnd total)
onerenge nignes” And VWuest marue 2+
meee = nro (Base nga
MONKS = Ar orercoy C1 Us 1s __4
prdak Cl Totod mars §” APs dyer ce e|
grind CN marin Reston Coons) » ;
PCO CH WroM ER tarts 4") NPs tox CrasLKs)) cribs
grind C!s, lowes) mors 4”, Ne. in Cares) )l +t "|
enente WEY malty ond digyiny cow ise Som 2SmA
Oe rpracweoy, CCL WAY E57 Gta], LA ori? Lisitais all
grav Cre Sum Cor onis=v) HE OXISE| moons Cowwise
OHS= 0 Means Colwrmurs
FU crente Smgloyee Solera Sala ond _cadculate average Soler,”
Sos
Qe Nes ORY" (195009, 0009, 35.009 40009, 4s-009 }) ——
v
prey C overage Saleny ke eae ae eee
Generate 26 mandam nomvor ond gore them 2
QAP. random Teondint (1100/20)
grad Cong inrat Arce! O)
geet _C" Sorded, sere 10, Sort C2)
SFM
Creple 3S mately ond Qind the weongnase 2,
Oetrannoy( LOW 3115.62) pba tot)
Psd CConqingl oxreay! 4 vn’, o)
qr C™ We Snonsease omnay 6.0", OT) k
HOT means: Wreagbose Crom 16 colina ond colunnis
au
Create 2 matrix Od Perforun addition 2
MO Ne orro4y CLLV2S BAU
fe ne omoy ( (1576), CHV
print C™ Sum of 9 orremy iS 4 any orb)
SSA TI Crepe 2 madeay ond Perfor _mulkilication 2
Oe nerarceoy CLE 211 13,41)
he Ne oneecoy (TL 561 -P4911) a
punt Ce mulfiplicaron of 9 orsoy (5 1 1m" Neeclat (a.b)
ee| Crrente % ephe OX S\udent result malty end find Seg
wise avertage 1
moras \Parercoy (Llaget 23),
(46,65) 30.)
(68,6), 48.)
[sia 4504) ~
erat C" Sulblectwise avg ts | Xn " Siertnenn (oars sayies
|
~~
~
|
q
Ariane to Roenctesie! aiieh one tones X28 merag
IBA Ineckucen oreo ond is} 2 Wie of
Unger numey OS OP van se | gl
(mpord Sy
Usk = Tu 33/45) |
0.
ont = NPs Oreo CLI 2) 3,45 J)
pesatl Memory used by USh 1", Sq Seqehsiaeot (igh)
Prat (Menor used toy en ane ah |)
anneihemgize Torts Si2e Sbgles\
§ Inob qreaaere than 50 And count the
humbere of shudent 7 Add Some grence mast 2
Qssqn grade 45 < malin