N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:1 LAB-01Pyt hon B asics A i m: Imp lem ent at ion o f Typeexp re
p ressio n s,Variab les,an d st rin g op er ation s A )Descr i pti on :
In t rod u cesou r f irst Pyt hon p ro gram, d at at ype s (in t egers,
f loa t s, st rin gs, boo lea n s), exp re ssion s, variab les, an d st
rin g operat ion s likecon cat enat ion an d slicing. [Link] PY
THONPROGRAM : n ame =in pu t ("Ent er you n ame :"); p rint ("Hello
",n ame ); ou tpu t: En t er you n ame: Ram ch aran Hello Ram ch aran
2.T YP EEX PRES SIONS: rad iu s=in t (inp ut ("Ent er rad iu s:")) Are
a= f loa t ((3.1 4* (rad iu s** 2))) circu m=(2* 3.1 4*rad iu s) p rint
("Are a= ",Area) p rint ("Circu mf u ren ce= ",circu m) ou tpu t: En t
er rad iu s:3 Are a= 28.2 6 Circu mfu re nce= 18 .84 3.V ARIABLES :
A=1 7 B=4 6 C=5 6 p rint (A+B+C) ou tpu t: 119 [Link] RIN G FUNCTIONS A="M
ahen dra " B="Sin gh " C="D h on i" p rint (A+B+C) N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:2 ou tpu t: M ah end ra Sin gh D honi Pyt hon Progr ammingFu
nda ment als B)A i m: Con d it ion san d Bran ch ing Loo p s, Fun ct ion
s, Ob ject s an d Classes Desr i pti on : Cove rs con t rolf low u sing
con d it ion s and b ran ch in g (if,elif , else st atement s), loop s
(fo r and wh ile loop s), d ef in in g and u sin g fu n ct ion s, and
in tro d u ces t he con cep t of ob je ct s an d classes (ob je ct-or
ient ed pro grammin g). 1. Co nd i ti on st atemen ts : a= in t (inp ut
("Ent er f irst nu mb er ")) b =int (inpu t ("Ent er second n u mber
")) c=in t (in pu t ("En t er th ird n u mber ")) if a> b and a> c: p
rin t (a,"is grea ter ") elif b >a an d b >c: p rin t (b ,"is gre at
er ") else : p rin t (c,"is gre at er ") O u tpu t: En t er f irst n u
mb er27 En t er second n u mb er 82 En t er th ird nu mber 85 85 is
grea t er 2. Br an chi n gl oo ps: n =int (inpu t ("en t er nu mber :"))
s=0 for iin ran ge(1,n+1 ): c=0 f or j in ran ge(1,i+ 1): if i
%j= =0 : c=c+1 if c==2: s=s+i p rint ("Su m: ",s) ou tpu t: en
t er nu mber :20 Su m: 77 N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:3 3. Fu nct ion s: d ef ad d (n): s=0 f or i in ran
ge(1,n+1 ): if i%2! =0 : s=s+i re t u rn s n =int (inpu t ("en
t er nu mber :")) p rint (ad d (n)) O u tpu t: en t er nu mber :16 64 4.
Cl asses an d O bj ect s: class o b j: d ef val(self ,var1 ,var2):
self .var1 =var1 self .var2= var2 ob j1 =ob j() var1 =in pu t ("En t
er valu e f or var1: ") var2 =in pu t ("En t er valu e f or var2: ")
ob j1 .val(var1 ,var2 ) p rint ("Class n ame :",ob j1 ._class.n ame _) p
rint ("Ob je xt _id ",id (obj1)) p rint ("In st an ce variab les:",ob j1
._dict _) ou tpu t: En t er value for var1: 10 En t er value for var2:
20 Class n ame : ob j Ob je ct _id 1396 247 630 265 60 In st an ce
variab les: {'var1': '10 ', 'var2 ': '20'} Wor kingwit hDa ta in Pyt
hon C)A i m: Loa d in g d at a with Pan d as, W or kin g with an d
Savin g d at a with Pa nd as Descr i p ti on: Fo cu ses on u sin gt h
e Pand as library for d at a man ip u lat ion a nd an alysis (load in
gd ata, wor kin g wit h D at aFrames, sa vin g dat a), an d commo n Pa
nd as op er at ion s. imp ort nu mp y as np import p an d as asp d
imp ort io csv_con t ent = """Row ID ,Te xt ,Keyph rase s,Rele vance
Score (R),Diver sit y Score (D),Con ciseness Score (C),Ut ilit y
Score (U),y N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:4 1,T h e govern ment is f ocu sin g on ren ewab le en ergy in
vest men t s.,Renewab le en er gy;En er gy p olicy,0.9
1,0 .85,0 .89,0.92,0 .85 2,A rt if icial in t elligen ce ist ran sf or
min g ed u cat ionan d h ea lt h care .,Art ificialin t elligen ce; AI
in ed u cation ,0.8 8,0 .83,0 .87,0.9 0,0 .85 3,N ew policiest ot
ackleclimat e ch an geare b ein g in tro du ced .,Climate ch an ge
policies; En viron ment al laws,0.90,0.8 4,0 .88,0.9 1,0.8 5 4,M achin
e lea rn in g is imp ro vin g p red ict ive an alytics in hea lth
care .,Ma chine lea rn in g; Pr ed ict ive analyt ics,0.89 ,0.8
6,0 .88 ,0.9 2,0.8 5""" d at a =p d .read _csv([Link] rin gIO(csv_con
t en t )) rele van ce_ scor es = d at a[ 'Relevan ce Score (R)'].valu es
d iversit y_score s =d at a['D iversit y Score (D)'].valu es con cisen
ess_scor es = d at a[ 'Con cisen ess Score (C)'].valu es u t ilit y_scor
es = d at a[ 'Ut ilit y Score (U)'].valu es y_valu es =d at
a[ 'y'].values A =n p .vst ack([re levan ce_score s, d iversit y_scor
es, con cisen ess_scores, ut ilit y_scor es] ).T b = y_valu es weigh t
s, r esid u als, ran k,s = np .lin [Link] sq (A, b , rcon d =N on e)
alp h a, b et a, gamma,d elta = weight s op t imiz ed =n p .all(A @
weigh t s >= 0.8 5)p rin t ("Calcu lat ed Weigh t s:")p rint (f"\u03 B1
(alp h a): {alph a}") p rint (f"\u 03 B2 (bet a): {b et a}") p rint (f"\
u03 B3 (gamma ): {gamma}") p rin t (f "\u03B4 (de lt a): {d elt a}") p
rint (f"D o th e weigh t s sat isf y y > 0.8 5 for all ro ws? {'Ye s'
if op t imiz ed else 'N o'}") d at a[ '\u03 B1 (alph a)']=alp h a d at
a[ '\u 03 B2 (bet a)'] = bet a d at a[ '\u 03 B3 (gamma )'] = gamma d at
a['\u 03B4 (de lt a)']= delt aou tp ut _p at h = "ou tp ut _with _weigh
t [Link]" d at a.t o_ csv(ou tp ut _pat h ,in dex=False ) print (f"Result
s saved to {outpu t _p ath }") O u tpu t: oµ oı ˚ˆır ~o› Z 8.3 49 095
673 546 583e-íï ˚ı -ôXñ ìììì ììì ììì òñô õ v ~: -ôXñ ìì ììì ììì ììõ íõ w
~ˆ˚oı 17 .00 000 000 001 4136 D ot h e weigh t s sat isf y y> 0.8 5 f or
all ro ws? N o Result s saved t o ou tp ut _wit h _weigh t [Link] LAB-
02Importing Da tasets A )Ai m: Imp or t in g an d Exp ort in g of d at a
,Basic In sight sf rom D at aset s . N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:5 Descripti on : EÆu]vı Z ˚ ˆ ı ’˚ı„µ ı µ „˚vcolu mn s,d at
atype s, nu mb er of rows, missin g valu es, and ove ralld ist rib ut
ion .Grasp th e con text in wh ich the d at a exist s (e.g., f in an
ce, h ealt h care, ret ail). Th is kn owled ge is cru cial f or int er
pre t in g resu lt s cor re ct ly an d makin g in f orme d d ecision s.
imp ort p an d as asp d f ile_ path ="/ conten t / Bost on Hou sin
[Link]" d f =p d .read _csv(file _pat h ) p rint (df .hea d ()) p rin t
(df .in f o()) p rint (df .describ e()) O u tpu t: crim zn in du s
ch as nox rm age d is rad tax pt rat io \ 0 0.0 06 32 18 .0
2.3 1 0 0.5 38 6.5 75 65 .2 4.0900 1 296 15 .3 1 0.0 27 31
0.0 7.0 7 0 0.4 69 6.4 21 78 .9 4.9671 2 242 17 .8 2 0.0 27
29 0.0 7.0 7 0 0.4 69 7.1 85 61 .1 4.9671 2 242 17 .8 3
0.0 32 37 0.0 2.1 8 0 0.458 6.9 98 45 .8 6.0622 3 222 18 .7
4 0.0690 5 0.0 2.1 8 0 0.4 58 7.1 47 54 .2 6.0622 3 222
18 .7 b lst at med v 0 39 6.9 0 4.9 8 24.0 1 39 6.9 0
9.1 4 21.6 2 39 2.8 3 4.0 3 34.7 3 39 4.6 3 2.9 4 33.4 4
39 6.9 0 5.3 3 36.2 <class 'p an d [Link] e.f rame .D at aFra me'>
Ran geIn d ex: 506 en t ries, 0t o50 5 D at a colu mn s (tot al14 colu
mn s): # Colu mn Non-N u ll Cou n t D t ype --- -- - -- - - --
- -- - -- -- - -- - -- - - 0 crim 506 n on-nu ll f loat 64 1 z n
506 non-n ull f loat 64 2 in du s 506n on-nu ll f loat 64 3 ch as
506 n on-nu ll int64 4 n ox 506n on-nu ll f loat 64 5 rm 506
n on-nu ll f loat 64 6 age 506 non-n u ll f loat 64 7 d is 506n
on-nu ll f loat 64 8 rad 506 n on-nu ll in t64 9 t ax 506
non-n u ll in t64 10 p t rat io 506n on-nu ll f loa t 64 11 b
506 non-n u ll f loat 64 N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:6 12 lst at 506 non-n u ll f loat 64 13 med v 506 non-n u ll
f loa t 64 d t ype s: f loa t64 (11), in t64(3) mem or y u sage: 55 .5
KB N on e crim zn in d u s ch as n ox
rm \ cou n t506.0 0000 0506.0 00 00050 6.000 000506.00 00 00506 .0000
00506.0 00 000 mea n 3.6 1352 4 11 .363 636 11.1 3677 9
0.069 170 0.5 546 95 6.2 846 34 std 8.6 01 54523 .322 4536.8
60 3530.2 5399 40.1 158 780.7 026 17 min0.0 06 320 0.0 00 000 0.4 6000
00.00 0000 0.3 8500 03.5 610 0025 %0.0 820 450.0 00 000 5.1 90 000
0.0 000 00 0.44 9000 5.8 8550 0 50 % 0.2 5651 0 0.00000 0
9.6 900 00 0.000 000 0.5 3800 0 6.2 085 00 75 % 3.677 083
12.5 0000 0 18.1 00 000 0.0 000 00 0.62 4000 6.6 2350 0 max
88 .97 620 0 100 .0000 00 27 .7400 00 1.0 0000 0 0.8 71 000 8.7
800 00 age d is rad t ax p t rat io b
\ cou n t506.0 0000 0506.0 0000050 6.000 000506.00 00 00506 .0000
00506.0 00 000 mea n 68.5 7490 13.7 950 439.5 4940 7408.2 371 5418.4
5553 4356.6 740 32std 28 .14 886 1 2.10 5710 8.7 072 59
168 .5371 16 2.1 6494 6 91 .29 4864 min 2.9 00 000 1.1
2960 0 1.00 0000 18 7.000 000 12 .600 000 0.3 20000 25 %
45 .02 500 0 2.100 175 4.0 00 000 279.0 0000 0 17 .40 000 0
375 .3775 00 50 % 77 .500 000 3.207 450 5.000 000 330.0 00
000 19 .050 000 39 1.44 0000 75 % 94 .075 000 5.1 884 25
24 .0000 00 666 .000 000 20.200 000 39 6.22 5000 max 10 0.000
000 12 .126 500 24 .000 000 711.0 00 000 22.0 0000 0 396.90 00 00
lst at med v cou n t 506 .0000 00 50 6.00 0000 mea n 12 .6530
63 22.532 806 st d 7.1 4106 2 9.1 97104 min 1.7 30 000 5.0
00000 25% 6.9 50 000 17.0 2500 0 50 % 11.3 6000 0 21 .2000
00 75% 16 .95 500 0 25 .0000 00 max 37 .97 000 0 50 .0000 00
Cle ani ngand Pr epa ringt he Dat a B)A i m: Id en tif y an d Hand le M
issin g Valu es, Dat a Fo rmattin g, D at a N or maliz at ion Se t s,
Bin n in g, Ind icat or variab les Descr i p ti on: Clea n in g an d
Pr ep arin g th eD at a Id en t if y and Hand leM issin gV alu es: Te
ch n iq u es in clud e: Removin g ro ws/colu mn s wit h missin gd at a
N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:7 Imp u t in g with mean / med ian /mo de Usin g int er pola t
ion or p red ict ion D at a Fo rmat t in g: Con vert d atat ype st o su
it ab le f orma t s, e.g., st rin gs t od atet ime, or ob je ct to nu
mer ic. En su re con sist en cy (e.g.,n o mixof cu rre n cies or u n it
s). imp ort p an d as asp d f ile_ path = "/ conte nt / Can ad ian
Immigrat ion D at aset .csv" d f = pd .read _csv(file _p ath ) d f
_clean ed =d f .dro p (colu mn s=[ "Un n amed : 0", "D at e (hidd en )",
"D ate Fu ll", "mo nt h _year "]) d f _clean ed["D at e"] =p d .t o_ dat
et ime(df _clean ed["D at e"], er ror s='coe rce') d f _clean ed .ren
ame (column s={ "In vit at ion s issu ed ": "In vit at ion s_Issued
", "CRS score of lowest-ran ked cand idat e in vit ed ":
"CRS_Score ", "Immigrat ion p ro gram": "Immigrat ion _Pro gram" },
in p lace=Tr u e)d f_cleaned .in fo(), d f _clean ed .h ea d () O u tp
u t: <class 'p an d [Link] e.f rame .D at aFra me'> Ran geIn d ex: 173
en t ries, 0t o17 2 D at a colu mn s (tot al8 colu mn s): # Colu mn
N on-N u ll Cou nt D t yp e - -- --- - -- - -- - -- - --
-- - -- - -- - - 0 D raw Nu mb er 17 3n on-n ull in t 64
1 D at e 173 n on-nu ll d at et ime64 [n s] 2 Immigrat ion_Pr
ogram 173 non-n ull ob je ct 3 In vit at ion s_Issu ed 173 n
on-n ull in t 64 4 CRS_Score 173 non-nu ll in t64
5 Pr ogr ams cove red 173 n on-nu ll ob ject 6 M onth
17 3 n on-n u ll int 64 7 Ye ar 173n on-nu ll int 64
d t ype s: d at et ime64[n s](1), in t64 (5), ob je ct (2) mem or y u
sage: 10 .9+KB (No n e, D rawN u mb er D at e Immigrat ion
_Pr ogr am In vit at ion s_Issu ed \ 0 17 220 21-01-07 Can ad ian
Exp erien ce Class 47 50 1 17 120 21-01-06 Pr ovin cial N om
in ee Pr ogram 25 0 2 17 020 20-12-23 N o pro gram specif
ied 50 00 3 16 920 20-12-09 N o pro gram specif ied
50 00 4 16 8 2020-11-25 N o p ro gram sp ecif ied
5000 CRS_Score Pro grams covered M onth
Yea r N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:8 0 46 1 Can ad ian Exp erien ce Class 1 20 21
1 81 3 Pr ovin cial N om in ee Progr am 1 202 1 2 46
8 Can adian Exp er ien ce Class Fed er al Skilled Wor ... 12 202 0
3 46 9 Can adian Exp er ien ce Class Fed er al Skilled Wor ... 12
202 0 4 46 9 Can adian Exp er ien ce Class Fed er al Skilled Wor ...
11 202 0 ) Model Development C)A i m: Simp le an d Mu lt ip le Lin ear
Regression , Mod el Evalu at ion UsingVisu aliz at ion , Polyn om ial
Regression an d Pipelin es, R-sq u are d and M SEf or In Sam p le Evalu
at ion , Pred ict ion a nd D ecision M akin g Descr i p ti on: M od el
Develo pment Simp le an d M ult ip le Lin ea r Regression : Simp le: Pr
edict on eou t come f ro mon e f eatu re M u lt ip le: Pred ict one ou
t come fro m mult ip lef eat u re s Simpl e Regr essi on : f ro m sklea
rn .model_ select ion imp ort t rain _t est _sp lit f ro m sklea
rn .lin ear_ model impor t Lin earRegression f ro m sklea rn .met rics
imp ort mea n _squ ared _e rror , r2_ scor e X = d f [['r m']] y = d
f['me d v'] X_ t rain , X_t est , y_t rain ,y_t est =t rain _t est _sp
lit (X, y, t est _size= 0.2 , ran d om_st at e= 42) mod el = Linea
rRegression () mod el.f it (X_t rain , y_t rain )y_p re d = mo d el.p
red ict (X_t est ) mse = mean _sq u ared _e rror(y_t est , y_p red ) r2
=r2 _score (y_test , y_pre d ) p rin t (f "Simp le Linear Regression - M
SE: {mse: .2f }, R²: {r2 :.2f }") p lt .figu re (figsiz e= (8,6)) sn
[Link] t erp lot (x=y_test ,y=y_p re d ) p lt .xlab el("Actu alPr ices")
p lt .ylab el("Pred icted Pr ices") p lt .t it le("Simp le Linea r Regre
ssion : Actu al vs Pre dict ed Pr ices") p lt .sh ow() O u tpu t: Simp
le Lin ea r Regression - M SE: 46 .14, R²: 0.3 7 N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:9 Mu l ti pl e Regr essi on: X= d f .d rop (colu mn s=[ 'med
v']) y = df ['med v'] X_ t rain , X_t est , y_t rain ,y_t est =t rain
_t est _sp lit (X, y, t est _size= 0.2 , ran d om_st at e= 42) mod el =
Linea rRegression () mod el.f it (X_t rain , y_t rain )y_p re d = mo d
el.p red ict (X_t est ) mse = mea n _sq u ared _erro r(y_t est , y_p red
) r2 =r2 _score (y_test , y_pre d ) p rint (f"Mu lt ip le Lin ea r
Regression - M SE: {mse: .2f }, R²: {r2 :.2f }") O u tp u t: M u lt
ip le Lin ear Regression - M SE: 24 .29 , R²: 0.6 7 Pol yn omial Regr
essi on: f ro m sklea rn .p rep ro cessin g impor t Po lyn om ialFe at u
re s f ro m sklea rn .p ipeline imp or t make_ p ip elin e p oly_m od el
= make_ p ipelin e(Po lyn om ialFe at ures(d egre e= 2), Lin ea
rRegression ()) p oly_m od el.f it (X_t rain [[ 'rm'] ], y_t rain ) y_p
red _poly = p oly_m od el.p red ict (X_t est [[ 'rm']]) mse_p oly = mea
n _squ ared _e rror (y_t est , y_p re d _p oly) r2_p oly= r2_ scor e(y_t
est, y_p red _p oly) p rint (f"P olynom ial Regression - M SE: {mse_
poly:.2f }, R²: {r2 _p oly:.2f }") O utp u t: N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:10 Po lyn om ial Regression - M SE: 35 .37 , R²: 0.5 2 I n ter pr
etation : samp le_ in p ut = [[0 .1,25 , 5, 0, 0.5 , 6.0 , 50 ,
5.0 ,2,20 0,15 ,39 0, 5]] p re d ict ed _p rice= mod el.p re d ict (samp
le_ in pu t )p rin t (f"Pre d ict ed Hou sin g Price:${p re d ict ed _p
rice[0 ] *10 00:.2 f }") O u tp u t: Pr ed ict ed Hou sin g Price: $2
860 5.48 D)Summarizingt he Data Frame A i m: Find in g cor re lat ion .
Descr i p ti on: Cor re lat ion mea su re s the st ren gth an d d
irect ionof a re lat ion sh ip b et ween t wo variab les. imp ort p
an d as as p d x= [1, 2, 3, 4,5] y = [5 , 6, 7,8, 7] d f =p d .D at
aFr ame({'x_valu e': x,'Y_ value': y}) x=d f .cor r(meth od ='ken d
all') O u tput: x_valu e Y_valu e x_valu e 1.000 000 0.7
37865 Y_ valu e 0.7 378 65 1.0 00 000 E)Mod el Eval u ation A i m: M
od el Se lect ion a nd Mod elEvalu at ion Descrip tion : M od el
Evaluat ion :E valu at e mod els u sin g met rics like accu racy, p re
cision , recall, F1-score (f or classif ication ) an d MSE, M AE, R²
(f or regre ssion ). p rint (f"Simp le Linea r Regre ssion - M SE:
{mse: .2f },R²: {r2 :.2f }") p rint (f"Mu ltip le Lin ea r Regressio n
- M SE:{mse: .2f }, R²: {r2:.2 f }") p rin t (f"Polyn om ial Regression
- M SE: {mse_p oly:.2f }, R²: {r2 _p oly:.2f }") p lt .figu re (figsiz
e= (8,6)) sn [Link] sid p lot (x=y_t est , y=y_p re d , lowess=T ru e, lin
e_ kws={'colo r': 'red '}) p lt .xlab el("Actu alPr ices") p lt .ylab
el("Residu als") p lt .t it le("Resid ual Plot f or M ult ip le Lin ea r
Regression ") p lt .sh ow() O u tp u t: Simp le Lin ea r Regression - M
SE: 24 .29, R²: 0.6 7 M u lt ip le Lin ear Regression - M SE: 24 .29 ,
R²: 0.6 7 Po lyn om ial Regression - M SE: 35 .37 , R²: 0.5 2 N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:11 samp le_ in p ut = [[0 .1,25 , 5, 0, 0.5 , 6.0 , 50 ,
5.0 ,2,20 0,15 ,39 0, 5]] p re d ict ed _p rice= mod el.p re d ict (samp
le_ in pu t )p rin t (f"Pred ict ed Hou sin g Price:${p re d ict ed _p
rice[0 ] *10 00:.2 f }") O u tpu t: Pr ed icted Hou sin g Pr ice:$2
8605 .48 LA B-03 A )In tr odu cti on to Vi su alizati on T ool s A i m:
In t rod u ct ion t o D at a V isu aliz at ion ,In t roduct ion to M at
p lot lib , Basic Plot t in g wit h M at plot lib ,D at aset on
Immigrat ion to Can ada, Lin e Plot s Descr i pti on : D at a visu
alizat ion is th egrap h ical rep rese nt at ion of d at a and in f
ormat ion .It h elp s in u n der st an d in g tre nd s, ou t lier s,
and p att ern s u sing visu al eleme nt s like chart s, gr ap h s,an d
map s. imp ort p an d as asp d f ile_path = "/ conte nt / Can ad ian
Immigrat ion D at aset .csv" d f =p d .read_csv(file _p ath ) impor t
mat p lot lib .p yplot as p lt imp or t seab or n as sn s sn [Link]
_the me(st yle="d arkgrid ") yearly_t ren d s = df _cleaned .group b
y("Ye ar")["Invit at ion s_Issu ed "].su m().reset _in d ex() p lt .figu
re (figsiz e= (10, 5)) sn [Link] ep lot (x=year ly_t ren d s["Yea r"],
y=yearly_t ren d s["In vit at ion s_Issued"], mar ker ="o ", colo r= "b
") p lt .xlab el("Year") N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:12 p lt .ylab el("Tot al In vit at ion s Issu ed ") p lt .t it
le("Immigrat ion T ren d s Over th e Yea rs") p lt .xt icks(yearly_t re
nd s["Year"] ) p lt .sh ow() O u tpu t: B)Basi c Vi su ali zation T
ool sA i m: Hist ogr ams,Bar Ch art s Descr i p ti on: Used to show t
hef re qu en cy d ist rib ut ion of a variab leb y grou p in g d at a
in to b in s Used to comp are q u an t ities of cat egorical d at a.
Can be vert ical or hor iz on tal p lt .figu re (figsiz e= (12, 6)) sn
s.b arp lot (dat a= df _clean ed , x="Immigrat ion _Progr am", y="In vit
at ion s_Issu ed ",est imat or =su m, ci=N on e) p lt .xlab el("Immigrat
ion Pro gram") p lt .ylab el("Tot al In vit at ion s Issu ed ") p lt .t
it le("D ist ribu t ion of To t al Immigrant s AcrossImmigrat ion P rogr
ams") p lt .xt icks(ro t at ion =45 ) p lt .sh ow() O u tpu t: N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:13 cou n try_immigrat ion = d f .group b y('COUN TRY ').su
m(n u mer ic_o n ly=Tr u e).su m(axis=1 ).sor t _valu es(ascen d in
g=False ) p lt .figu re (figsiz e= (8,4)) sn s.h ist p lot (count
ry_immigrat ion , bin s=30, kd e=Tr ue, colo r= "red ")p lt .xlabel("Tot
al Immigran t s")p lt .ylab el("Nu mb er of Cou n t ries") p lt .t it
le("D ist ribu t ion of To t al Immigrant s AcrossCou n t ries") p
lt .grid (Tru e)p lt .show() O u tp u t: C)Sp eci al i zed Vi su
ali zation Too l s A i m: Pie Ch art s, Box Plot s, Scat t er Plots
Descr i pti on : Used to show p art s of awh ole . E ach slice rep re
sen t s a p ercen tage of t h e tot al Also called b ox-and-wh isker p
lot s. Th ey sh owt he d ist ribu t ion , med ian , qu art iles, an d
outlie rsof a N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:14 d at aset .Used t oexamin e re lat ion sh ip sb et wee n two n
u merical variab [Link] f u l for spott in g cor re lat ion s an d p
at t erns. t op _5_ pro grams= df _clean ed .grou pb y("Immigration _P
rogr am") ["In vit ation s_Issued "].sum().n large st (5) p lt .figu
re(figsiz e= (7, 7)) p lt .p ie(t op_5_p ro grams,lab els= top _5_ p
rogr [Link] d ex, au top ct ="%1.1f %%", st artan gle=14 0, colo rs=sn
[Link] r_p ale tt e("p ast el")) p lt .t it le("Prop ort ion of
Immigrat ion f ro mTo p 5 Pr ogr ams") p lt .sh ow() O u tp u t: p
lt .figu re (figsiz e= (6,4)) sn s.b oxp lot (da t a=df _clean ed ,
x="Immigrat ion _Progr am", y="In vit at ion s_Issu ed ") p lt .xlab
el("Immigrat ion Pro gram") p lt .ylab el("In vitat ion s Issu ed ") p
lt .t it le("St at ist ical D istrib u t ion o f Immigrat ion Dat a &
Out lier s") p lt .xt icks(ro t at ion =45 ) p lt .sh ow() O u tpu t:
N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:15 p lt .figu re (figsiz e= (10, 6)) sn [Link] t erp lot ( d
at a= df _clean ed , x="Yea r", y="CRS_Score ", size="In vit at ion
s_Issu ed ", h u e= "Immigrat ion _P rogram", alph a= 0.6 , siz es= (20,
500) ) p lt .xlab el("Year") p lt .ylabel("CRS Score ") p lt .t it
le("CRS Score vs Ye ar with In vitat ion s Issu ed as Bu bble Siz e") p
lt .legen d (tit le= "Immigrat ion Pr ogr am",b b ox_t o_a n ch or
=(1.05,1),loc="up p er left") p lt .sh ow() O u tpu t: N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:16 D)Ad van ced Vi su al i zati on T ool s A i m: Wor d Clou
d s,Seab orn and Regression Plot s Descr i pti on : A visu al rep re
sent at ion of text d at a wh ere th e siz e of ea ch word ind
icat es it s f req uen cy or imp ort an ce. Great f or t ext an
[Link] abor n is a Pyth on d at a visualiz at ion lib rary bu ilt
on t op of M at p lot lib . It p ro vides a h igh-level in t erf ace for
d rawin g at tract ive and in f or mat ive st at ist ical grap h ics. f
ro m word cloud imp ort Wor d Cloud word clou d =Wor d Cloud(wid t h=8
00, h eight =4 00,b ackgrou nd_colo r= "wh it e", colo rma p ="coo
lwarm").gen er at e_f ro m_f req u en cies(cou n t ry_immigrat ion ) p
lt .figu re (figsiz e= (8,4)) p lt .imshow(wor d clou d , in t erp olat
ion="b ilin ea r") p lt .axis("of f ") p lt .t it le("Count ryN ame
sBased on Immigrat ion M agn it u de") p lt .sh ow() O u tp u t:
N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:17 cor re lat ion _mat rix = df [visa_colu mn s].cor r()p
lt .figu re (figsize= (8, 4)) sn [Link] gp lot (x=year ly_t ren d [Link]
ex, y=yea rly_tre nd [Link] es, scatt er =Tr u e,mar ker ="o ", colo r=
"b lue", lin e_ kws={"colo r": "red "}) p lt .xlab el("Ye ar") p
lt .ylab el("Tot al V isa Issuan ce") p lt .t it le("Tren d of T ot
alVisa Issu an ce Over Tim e") p lt .grid (Tru e)p lt .show() O u tp u
t: N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:18 LAB-04WEBSCRAPING A i m: Imp lem ent at ion o f Web Scrap in gu
sin g Beau t if u lSou p ,requ est s,u rllib . Descr i p ti on: Web
scrap in g is th ep ro cess of a ut om at ically e xt ractin gd at a f
rom web sit es. In d at a scien ce, it isu sed t o colle ct largeamo
u nt s of d at a f rom onlin e sou rcesf or an alysis,mo d elin g, an d
in sight s. Pyt h on ison e of th e mo st popula r lan gu ages f
orweb scrap in g du et o it spowerf u l lib raries an d ea se of u
se. Her e's a b reakd own imp ort req u est s f ro mb s4 imp ort Beau
t ifu lSo up u rl="ht tp s:// www.n ytime [Link] / in ter n at ion al/ "
re sp on se= req u est [Link] (url) if re sp on [Link] atu s_code= =20 0:
sou p =Beau t if u lSou p (resp on se.t ext ,'ht ml.p arser ') p ara=
sou p .fin d _all('p') for text in para: p rint (te xt .get _text
()) e lse: p rin t ("er ror can 't f et ch ") O u tpu t: l ’˚v ’˚ }
( ıZ ˚ ˆ Ç[’v ˚Á’ v ˆ ]ˆ˚ ’X An alysis th at exp lain s polit ics, p
olicy an d ever yda y lif e. Th eb iggest st ories of our t ime, in 20
minu tes aday. On th e camp aign t rail wit h Ast ead Hern d on . Get
wh at you nee d t o know t o st art you r d ay. voÇ’ZÁ˚˚ l ]PP˚’ı Po}
’ı }„]˚’X Th e lat est news f or an ypart of t h e wor ld you
select . Backst or ies an d an alysisf ro mou r Can ad ian corresp onde
nt s. Th e most cru cialb u siness an d p olicyn ews you n eed t o kn
ow. Ou r tech jou rnalist sh elp you make sen seof t he rap id ly ch
an gin g t ech wor ld . Boo k re com menda t ion sf ro mou r crit ics.
St re amin g TV and movie re com menda t ion s. Th ep od cast t h at t
akes you in sid e th e lit er ary wor ld . Po p mu sicn ews, n ew son
gs a nd alb u ms, and art ist s of not e. Th e lat est news on wh
atwe wea r, b y ou r ch ief f ash ion crit ic. Essen t ial n ews an d gu
idan ce to live you rh ea lt h iest life. Th e comp licated love
lives of r ea l p eop le. Th ou gh t s, alou d . Wit h Mich elle Cot t
le, Ross Douth at , Carlos Loz ad a and Lyd ia Polgr een . D iscu ssion
sof id ea s th atmat t er, plu sb oo k recommen d at ion s. Po d cast s
and n arrated art icles cove rin g news, t ech , cu lt u re and mor e.
}v À˚„’ı ]}v Á]ıZı Z ˚Á}„ oˆ }’ı ( ’]v ı ]v› ˚} › o˚X Yo u r mo rnin g
list en . Top st or ies, in 10 min ut es. N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:19 A Hollywoo d orca's re al-lif e od yssey b ack tot h e ocea
n . Ou r edit or s sh are th eir favor it e list en s fro mt heN ew Y or
k Times Au d io ap p . Wor d games, logicp uz z les and cro sswor d
s,in clud in g an ext en sive arch ive. Sp ellin g Bee Th eM in i Cro
sswor d Wor d le Th e Cro ssword St rand s Con n ect ion s Su d
oku Let t er Boxed Tile s Pu zz les,b rain tea sers, solvin g t ip s
an d mor e. Get an ea sy versio n of on e of t h e h ard est cro
sswor d p uz z les of th e wee k. Recip es, ad viceand in sp irat ion
for everyda y coo kin g, sp ecial occasion san d mo re . N ew re cip
es, ea syd inn er id ea s and smart kit chen t ip sf ro m M elissa
Clark, Sam Sift on a nd ou rN ew Yo rk Tim es Coo kin g ed itor s. D
eliciou s veget arian re cip es an d t ip s f rom Tan yaSich ynsky. D
in ner id ea sf or b u sy p eop lef ro m Emily Wein stein . Reviews an
d recom mend at ion sf or t hou sand s of p ro du ct s. Th eb est ind
epend ent reviews, e xp er t ad vice an din t en sively re search ed
dea ls. St ep-by-st ep ad viceon how t o keep everyth in g in you rh om
e squ ea ky clean . Pe rso n aliz ed cove rage of you r sp ort s tea ms
an d lea gu es. D eliver in g th et op stor ies in sp or t s, Sun d
ayt o Frid ay. Th et op stor ies in t h e N FL, f ro m Jacob Rob in
sonwit h D ian na Russin i. Conne ct ion s: Sp or t s Ed it ion Con n
ect ion s Coa ch l ’˚v ’˚ }( ıZ ˚ ˆ Ç[’v ˚Á’ v ˆ ]ˆ˚ ’X An alysis th
at exp lain s polit ics, p olicy an d ever yda y lif e. Th eb iggest st
ories of our t ime, in 20 minu tes aday. On th e camp aign t rail wit
h Ast ead Hern d on . Get wh at you nee d t o know t o st art you r
d ay. voÇ’ZÁ˚˚ l ]PP˚’ı Po} ’ı }„]˚’X Th e lat est news f or an ypart
of t he wor ld you select . Backst or ies an d an alysisf ro mou r Can
ad ian corresp onde nt s. Th e most cru cialb u siness an d p olicyn
ews you n eed t o kn ow. Ou r tech jou rnalist sh elp you make sen
seof t he rap id ly ch an gin g t ech wor ld . Boo k re com menda t ion
sf ro mou r crit ics. St re amin g TV and movie re com menda t ion s.
Th ep od cast t h at t akes you in sid e th e lit er ary wor ld . Po p
mu sicn ews, n ew son gs a nd alb u ms, and art ist s of not e. Th e
lat est news on wh atwe wea r, b y ou r ch ief f ash ion crit ic.
N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:20 Essen t ial n ews an d gu idan ce to live you rhea lt h iest
life. Th e comp licated love lives of r ea l p eop le. Th ou gh t s,
alou d . Wit h Mich elle Cot t le, Ross Douth at , Carlos Loz ad a and
Lyd ia Polgr een . D iscu ssion sof id ea s th atmat t er, plu sb oo k
recommen d at ion s. Po d cast s and n arrated art icles cove rin g
news, t ech , cu lt u re and mor e. }v À˚„’ı ]}v Á]ıZı Z ˚Á}„ oˆ }’ı
( ’]v ı ]v› ˚} › o˚X Yo u r mo rnin g list en . Top st or ies, in 10
min ut es. A Hollywoo d orca's re al-lif e od yssey b ack tot h e ocea
n . Ou r edit or s sh are th eir favor it e list en s fro mt heN ew Y or
k Times Au d io ap p. Wor d games, logicp uz z les and cro sswor d
s,in clud in g an ext en sive arch ive. Sp ellin g Bee Th eM in i Cro
sswor d Wor d le Th e Cro ssword St rand s Con n ect ion s Su d
oku Let t er Boxed Tile s Pu zz les,b rain tea sers, solvin g t ip s
an d mor e. Get an ea sy versio n of one of t h e h ard est cro
sswor d p uz z les of th e wee k. Recip es, ad viceand in sp irat ion
for everyda y coo kin g, sp ecial occasion san d mo re . N ew re cip
es, ea syd inn er id ea s and smart kit chen t ip sf ro m M elissa
Clark, Sam Sift on a nd ou rN ew Yo rk Tim es Coo kin g ed itor s.
Deliciou s veget arian re cip es an d t ip s f rom Tan yaSich ynsky. D
in ner id ea sf or b u sy p eop lef ro m Emily Wein stein . Reviews an
d recom mend at ion sf or t hou sand s of p ro du ct s. Th eb est ind
epend ent reviews, e xp er t ad vice an din t en sively re search ed
dea ls. St ep-by-st ep ad viceon how t o keep everyth in g in you rh om
e squ ea ky clean . Pe rso n aliz ed cove rage of you r sp ort s tea ms
an d lea gu es. D eliver in g th et op stor ies in sp or t s, Sun d
ayt o Frid ay. Th et op stor ies in t h e N FL, f ro m Jacob Rob in
sonwit h D ian na Russin i. Conne ct ion s: Sp or t s Ed it ion Con n
ect ion s Coa ch As U.S. an d Russian Of f icials M eet ,Ta lks Are Se
t to Go Beyon d Ukraine Th et wo sides are meet in g in Saudi Arab ia f
or their mo st exten sived iscu ssion s in years. In add it ion t o
Ukraine, bu sin ess t iesare on th e t ab le. 4 min re ad Russia Fre
esAme rican Prison er Bef or e Ta lks Wit h U.S. 2 min re ad Eu ro pea
n Lea der sM eet in Pa ris as U.S. Pu sh es Ahea d Wit h Ukrain ePla
n N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:21 Th eh ast ily calle d gat her in g was p art of a f lu rry of
d ip lom acyt h is wee k as Tru mp officials pre p are d t o st art t
alks with Russiaon t h eir own . 7 min re ad v ˆ ˚›-by-St ep Gu id e
t o aPo ssib le Ukrain eD ea l. 6 min re ad All 80 Ab oard Su rvive asJe
t Crashes an d Overt u rns at To ron t o Airp or t At lea st 18 p eop
le wer e in ju red wh en t h e Delt a f ligh t f ro m M in n eapolis t
ried t o lan d amid st ron g win d s and d rift in g sn ow,of f icials
said . Pa ssen gers Recou nt t h eCrash Two p eop le wh o wer e ab oa
rd d escrib ed f in d in gth emse lvesu p sid ed own af t er wh at h ad
seeme d like a rou t in ed escent . 2 min re ad St rin g of Air Crash
es in 2025 Has Rat t led Tr avele rs 2 min re ad Wh at We Kn ow A bout
the To ronto Pla n e Crash 3 min re ad To p Social Se curit y Of f
icial Lea ves Af ter M u sk Te am Se eks D at aAccess ı ]v }uu]’’]} v˚„
}À˚Z ›› ˚v˚ˆ( ı˚„ v µ ’lı ˚ ’}µ PZı ’˚v ’]ı ]À ˆ ı }µ ımillio n sof Ame
rican s. 4 min re ad ˆ ˚„ oˆ ˚o]v ˚’ ıo}l µ ’l ˚À]v ıˆ µ ı ımin re ad
Wit h Con gressPlia nt , an Emb old en ed Tr u mp Pu sh es His Bu
siness Int er ests 7 min re ad Cost a Rica WillTa ke 200M igrant s Dep
ort ed b y the U.S. 2 min re ad Ed u cat ion D ep t . Gives Sch oo ls2
Weeks t oElim in at e Race-Based Progr ams4 min re ad }µ ’v ˆ ’Z
˚„}v˚’]ˆ ˚vı µu›ı 4 min re ad v ıZˆ}} l ’ıµ u› „](( ’M 5 min re ad M
id dle East Ten sion s As D ead lin e for Wit hd rawal Lapses, Israe l
Says It Will St ay in South ern Leban on „˚ ( } Á „˚ u]vı ( ’ı „ı› }]v
ı Á]ı Z ]v v }vˆ ˚’› ]ı Ç[’ ˆ ˚ˆ o]v( }„ Israe li t roo p s and Hezb
ollah figh ter st op u ll b ack. 3 min re ad ’ı ˚µv ı o˚’µ v ı (}„ ’
at ing in t h e Air In 19t h-cent u ry F ran ce,th e you n g chemist ch
allen ged t het h eor y of spon tan eou s gener at ion a nd d iscove
re d an in visib le wor ld of airb orn e microbes. 6 min re ad N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:22 Got a Tip ? T he Times of fer s severa l ways t o sen dimp ort
ant inf or mat ion con f id ent i U.S. M arin es St art t o Leave Jap
an ,D ecad es Beh ind Sch ed u le Th e Amer ican b ase on Okin awa h as
re locat ed 105 M arin es. But an agreemen t t o mo ve 9,000 in t
ot al is collid in g wit h t hep er ceived th re at f ro ma risin g Ch
in a. 5 min re ad Okin awa, a Sma ll Island Cau gh t Bet wee n Big Po
wer s Resid ent s of th e Jap an ese island see U.S. b ases as a
legacy of war an d colon ialism,b ut youn ger gen er at ion s also wor
ryab out a th re at f rom Ch in a. 3 min re ad }„ l„v }„ ı ]’µµ ıµ
„˚ı˚„›ˆ v ı } gn Kat h y Hochu l, who cou ld re mo ve M ayor Eric Ad
ams, said t he p lan ned re sign at ion of f our depu t y uÇ}„ ˚„vZ
^o}v P-ı ˚„ u ( µıµ „˚ ı]ı 5 min re ad Ju d ge in Ad ams Case Faces D
eman d s t o Continue t h e Pr ose cu t ion As t he ju d ge con siderı Z
’ı ]˚› „ı u˚v ı [’ „˚‰ µ ˚’ıı ’ıZ ’˚ P]v ’ıAd ams of N ew Y or k,f ormer
U.S. att orn eys a sked h imt o in vest igat e. 5 min re ad › ˚ ı }
Ç ]v}’› ]ı o ıˆ „˚›o]v]’µ ı ]v Po p e Fra n cis, 88 , was said to be
in st ab le con dit ion on Monda y aft er b ein g ad mit t ed t o a
hosp ital in Rome lat e last wee k wit h a re sp irator y inf ect
ion . 3 min re ad Wh en GraveM arker s Are St olen , He Spea ks f or th
eD ea d To M ich ae l Hirsch , th edese crat ion of h u nd red s of
graves was a sh an d a, a sh ame , a gh ou lish crime . He wan t ed tod
o somethin g about it . 7 min re ad So u th west Airlin es Plan st o
Cut 15% o f Cor por ateWor k Fo rce Th e airlin e said it wou ldcu t
1,75 0 job s, th ef irst bro ad layof f s in it s53-year h istor y. 2
min re ad Can ad a as th e51 st St aı ˚ ı}„ µu› ˚ ’ ˚u}„ı ’X „]v P]vv
ˆ ]v ı ıZ ˚ ]ı ˚ˆı ı Z( „] ˚’]ˆ ˚v ı µ u› [ ]ˆ ˚ ’˚˚ uU Á}µ oˆalt er t
he polit ical map ina way likely t o cost Rep ub lican s. 5 min re ad
ı ñì ˚o˚ „ı ˚s 50 Years With a St ar-Stu dd edPr ime-Tim e Sp ecial v
ˆ µˆ ]˚v ˚ o]l˚ Á˚„ › l˚ˆ Á]ı Z ı µ„ˆ ]PZ ı ’ı U oµuv v ˆ}ıZ ˚„ ˚o˚
„]ı ]˚’on a n ight t h at was in t u rn s swee t and self-sat iriz in
g. 8 min re ad Kim Sae-ron , a Young Sou t h Ko rean Act re ss, Is Fou n
d D ead Th e24-year-old star, on ce a ch ild act or , ap pea red at t
he Cann es Film Fe stival an d on Netflix, un t il a d run k-d rivin g
in cident in 20 22 d eraile d h er care er. 3 min re ad Brad Se t ser
N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:23 l]v P ıZ„oˆ }„Z ]v [’ ]’ıl˚’ 5 min re ad TheEd it or ial Boa
rd µ ’]v P ı }ıµ u› oP„vı oÇ ]’Z }v˚’ı˚„ ’ 7 min re ad Gail Colli n s
an d Bre t St eph en s N oth in gt o Se e Her e. Everyth in g Is Exact
ly as It Shou ld Be. 7 min re ad Rich ard L. Revesz ı ı oZ ıv ˆ ˚„u]v
˚vuen t 5 min re ad M argaret Ren kl Pr aise Son gf or a False Sp rin g
5 min re ad Javid Ah mad Th e U.S. Can N o Lon ger Ign or et he Th re
at Arisin gin Af gh an ist an 5 min re ad Let t ers Fro m Ou r Read
ers „Pµ }µ ıZ }v ˚’ ~v ˆ Z ]v˚ 5 min re ad Hen ry J . F arrell an d Ab
rah am L.N ewman Th is Is How T ru mp Will Smash th e M achin eof
U.S. Econ om icPo wer 6 min re ad Alliso n Sweet Gran t ˚„ ˚[’ ˚˚
oo ]oˆ „˚v ðmin re ad Kirk Wallace Joh n son oµv [ı µ oo]( ]˚ˆ vıˆ˚„ [
Ez ra Klein › µ o]v „ı Ç[’ } o˚u v an d Ou rs Eliz abeth Sp ier s Th e19
80s Are Back, an dN ot in a Good Way 6 min re ad Ad vert isement Agen t
Oran ge Twist ed Her Limb [Link] e U.S. Is Ab an d on in ga V owt o Help
. Fif t y years aft er t he V ietna m War, Pr esid en t Tr uu›ı ı ]v }((
}„ ˚]Pv ]ˆ Z ’ Z oı ˚ˆ ˚( ( }„ıı ad d re ss at oxic legacy and bu ild a
st rategic p art nersh ip . 6 min re ad Killin g of Tran sgen d er Man
Is Not Ru led a Hat e Crime, In vest igat ors Say Law en f orceme nt
of f icials in u p stat e N ewYo rk said th at th et ort ure an d
killin g of Sam N orq u ist , 24 ,d id n ot ap p ear tob ea h at e
crime . 3 min re ad N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:24 }„ ’Zv P˚„ Z ˚u]µ› }„ı ]vZ ]v Ch in ese d rivers are b u yin
g aff ord ab le ele ct ric veh icles load ed wit h n ewtech n olo gy, at
re nd t h at is re d ef in in g h igh-en d veh icles an d hu rt in g
German au t omaker s. 3 min re ad Pa q u it a la del Barrio , Whose Son
gs E mpowere dWom en , D ies at 77 In un f lin ch in g b allad st h at
sp oke of th ep ain men can cau se women ,t heMexican sin ger often
re lied on wh at sh e lea rned in her own re lat ion sh ip s. 3 min
re ad Th e At h let ic Th e Cre at or of Wallace an d Grom it Bre ath
es Lif e In t o a Cast of Clay ]l „l ı ˚’ı( ]vı Z ˚ ’ı }›-mot ion
series is u p f or mu lt ip le award s at th e BAFTA s and t he Oscars.
5 min re ad Au d io Game s Wor d le Gu ess th e5-let ter wordwit h 6
ch an ces. Con n ect ion s Gro u p wor d st h at sh are a com mo n th
re ad . St rand s Un cove r h id den word s an d revea lt h e th eme .
Sp ellin g Bee How m an y wor d s can you make with 7 let t ers? Th e
Cro ssword Get clu ed in with word p lay, e very d ay. Th eM in i
Cro sswor d Ta ke a bre ak f rom t h e news. So lve t h is b it e-siz
edp u zz le in ju st af ew min ut es. B)Ch at b ot Aim: creatingachatg
ptusingN LP. Descr i p ti on: A ch atb ot is a com pu t erp ro gram d
esign ed t o simu lat e hu man con versat ion . It can int er act wit
h u sers viat ext or voice, an swer in g q uest ion s,p ro vid in g in
f ormat ion ,or even p erf ormin gt asks. In d at a scien ce, ch at b
ot s are of ten p owered b y nat u ral lan gu agep ro cessin g (NLP ) an
d mach in e lea rn in g, allo win g th emto un d er st and an d re
spond to u ser in pu t s in a smart , con versat ion al way. Pyt h on
is commo n ly u sed to bu ild ch at b ot sb ecau se of it s st ron
glib rariesf or N LP,mach ine lea rn in g, and web int egrat ion . imp
ort n lt k f ro mn lt k.t oken iz e import wor d _t oken iz e n lt k.d
own load ('p un kt _t ab ') N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:25 # Pr ed efin ed keywor d-resp on se d ict ion ary re sp on ses
= { "h ello": "Hello! How can I a ssist you t od ay?", ŠZ ]ŠW
ıZ ˚„ ˚Jı [’ }v Ç}µu]vˆ MŠU "h ow a re you ": "I'm just ab ot, but
I'm doin g grea t ! How a b ou t you ?", "b ye": "Goo db ye! Have a
great d ay!", "u seof ch atb ot ":"ch atb ot h elp you t of ind a
solu t ion f or t he given p rob lem", "joke":"you are b eau t if u
l! ", "wea t her ":"It 's very cold ijn th emo rn in g an d n igh t
an d it is hot d urin gaft er noo n irre sp ect ive of t h e seaso n ",
ŠÇ}µv u˚ ŠZ ı}ı Ç}µ À]„ı µ o ’’]’ı v ı XŠU "h elp ": "I can ch at
with you! Try a skin g ab outmy n ame , greet in gs,or ju st sayh
ello .", } d ef get _r esp on se(u ser_ in p ut): """Ch eck u ser in
pu t again st known re sp on ses an d retur n a re p ly.""" u ser_
inp ut =u ser_ inp ut .lower () word s = wor d _t oken iz e(u ser
_inpu t ) f or key in re spon ses: if key in u ser_ inp ut :
ret u rn re sp on ses[key] ret u rn "I'mn ot sure h owt o re spon
d to t h at . T ry a skin g som et h in g else! " d ef ch atb ot ():
"""Main ch at b ot f un ct ion t h at ru n s in a loo p .""" p rin t
("Ch at Bot : Hello! Typ e 'b ye't o exit .") wh ileTr ue: u
ser_ inp ut = in p ut ("Yo u: ") if u ser_in pu t .lower () == "b
ye": p rint ("Ch at Bot:", re sp onses[ "b ye"]) b rea k
resp on se = get _r esp on se(u ser_ in p ut) p rint ("Ch at
Bot:", resp onse) ch at bot () O u tpu t: [n lt k_d at a] Down load in g
p ackage pu n kt _t ab to /roo t /n lt k_d at a... [n lt k_d at a] Unz
ip pin gtoken iz er s/ pu n kt _t ab .z ip . Ch at Bot : Hello ! Type 'b
ye' t o exit . Yo u : Hello Ch at Bot : Hello ! How can I a ssist you t
od ay? Yo u : How a re you ? Ch at Bot : I'm ju st a b ot ,bu t I'm d
oin g great ! Howab out you ? Yo u : you r n ame Z ı}ı WZ ı}ı U Ç}µ À]
„ıµ’’]’ı vı X N210782
Akaasapu Til ak D at a Scien ce Wit h Pyth on
p gno:26 Yo u : h elp Ch at Bot : I can ch at wit hyou ! Tr y askin g ab
out my n ame , greet in gs, or ju stsay h ello . Yo u : greet inh s Ch
at Bot : I'm not su re h ow t o re sp ondt ot hat . Try a skin g som et
h in g else! Yo u : b ye Ch at Bot : Good b ye! Have a great d ay!