Statistics Assignemt

You might also like

Download as pdf
Download as pdf
You are on page 1of 19
1191723, 350 PM 21,.Statistios_Assignment_Day_21.Ipynb -Colaboratory Telecommunication Industry Project Introduction ‘This Jupyter notebook is part of your lesming experience in he study of applied statistic, You will work with a dataset that contains mobile phone prices and thelr specifications Dataset Columns information PID = a unique identifier forthe phone model Blue = whether the phone has bluetooth support or nat WiFi = whether the phone has wifi support or not Ser = whether the phone has touch sereen support ar not ExLMem = whether the phone has external memory support or not Pel jumber of lve inthe vertical also the phone Px.w= numberof pixels inthe horizontal xis ofthe phone. Ser = height ofthe screen ofthe phone in centimetres (em) ‘Scr_w = width of the screen of the phone in centimetres (em) In Mem = intemal memory f the phone measured in megabytes (MB) Bty_Pwr = maximum energy stored by the phone's battery measured in milAmpere-hours (mAh) PC = resolution ofthe prmary camera measued in megapixels (MP) /esolution ofthe front camera measued in megapixels (MP) RAM « random access memory availabe in the phone measured in gigabytes (G8) Depth = depth ofthe mabile phone measured in centimetres (em) Wielght = weight ofthe mobile shone measured in grams (a) Price = seling price ofthe mobile phone in rupees Task 1 - Load and study the data Import te lraries that willbe used inthis notebook Angort natplotlibpyplot as plt Load the esv file as pandas dataframe. 1 Read in the “Dat(aset” Fie as a Pandas Data Frane fata = pdarend_cev(:/content/mobéle Phones.ce¥") f Take a brief Look at the ats atastead) npe:folab research google. comidriva/TesqhAX8D yal LBBN7u23TqOGIMXpIGaxbscrollTo=7p5Rg_AKNBSBSpHnIMode=true ane 1191723, 350 PM 21..Statistios_Assignment_Day_21.Ipynb -Colaboratory 2 BABES) mo yes =m mm HD 7D? 80 Rangeindex(start-8, stopsse, stepet) raex({"P10", “alu, ch Ser", “Ext Hen, “PRA, "PRw, “Ser fatavin‘ot) Se nennll inte Se Price 58 non-nill inte atypes! ineeaca2y, object Observations: ‘There are 50 phones inthe data set ‘There are 17 features inthe dataset including the "PID" feature which is used as the row index labels. ‘There are no missing values inthe dataset npe:folab research google. comidriva/TesqhAX8D yal LBBN7u23TqOGIMXpIGaxbscrollTo=7p5Rg_AKNBSBSpHnIMode=true ane 1191728, 350 PM 21..Statistios_Assignment_Day_21.Ipynb -Colaboratory Logical Operators Result [Logical AND Logical OR [Logica XOR (exclusive OR) |Shortcreuit OR lea Shortcut AND ! ‘Logical unary NOT AND assignment foReocignert "TKOR assignment [Equal to Not equal to Pe Temary itthenlee TTT ‘Task 2 - Obtain the logical conditions for the features "Blue’, "WiFi "Tch_Scr" and “Ext_Mem" rdex(("PIO", "Blue", “ALFE!, “Teh Ser", “Ext Men! “PALM, "Paw, “Ser. 20> pd.vatatrane(aata,colums = ['alue", "MLES", "TehSer", "Ext MR") npe:folab research google. comidriva/TesqhAX8D yal LBBN7u23TqOGIMXpIGaxbscrollTo=7p5Rg_AKNBSBSpHnIMode=true ane 1191723, 350 PM 8 6 4 cnente 3 10 Observations: ve ves vs yes 21..Satistios_Assignment_Day 2 ical condition for this situation ane store the logical values a5 “cont” ‘The features “Ble’, "WF", "Tch Ser" and "Ext Mem* are binary in nature, npe:folab research google. comidriva/TesqhAX8D yal LBBN7u23TqOGIMXpIGaxbscrollTo=7p5Rg_AKNBSBSpHnIMode=true ipynb - Colaboratory ang 1191728, 350 PM 21,.Satstios_Assignment_Day_21.pynb - Colaboratory ‘The children want all these features, so the logial contin ‘cont has been obtained accordingly. ‘Task 3 - Obtain the logical conditions for the features "Px_h’ and Jex(('PI0", “Sue, “MLLFL', “Teh Ser", “Ext Mens “Pan, "PMs “SCAN, G44 = pdbatatrane(data,coluans © [Px hy Pw) npe:folab research google. comidriva/TesqhAX8D yal LBBN7u23TqOGIMXpIGaxbscrollTo=7p5Rg_AKNBSBSpHnIMode=true one 1191723, 350 PM 8 6 2500 2500 2000 2500 2900 1980 1440 1920 1960 2120 1960 2120 1760 280 21,.Statistios_Assignment_Day_21.Ipynb -Colaboratory Seale] ofa Pan 1 A 'Pew'T - StasheasO) 40 0 4a Px Jonean() Fa" J -medion() pie. pit npe:folab research google. comidriva/TesqhAX8D yal LBBN7u23TqOGIMXpIGaxbscrollTo=7p5Rg_AKNBSBSpHnIMode=true e00 igure(sigsize = (11,5)) hiseploc(sata = of xe'9x',colore' red! ,edgecolor = ‘1inen',alpha = @.5,bins = 5) title("Histogran of Px") wlabel( width") label ("Height") ‘lines sf Pe viines (af "Pe egend() stent) nean(), ynin = @, ywax = 25, colorss"green’, Labele'Mean") sedlan(), yntn = 6, ymax = 25, colorse black’, Jabel="Medlan”) ene 1191723, 350 PM 21..Statistios_Assignment_Day_21.Ipynb -Colaboratory Histogram of x on2 = ata (dee Pah J>=2448)8(@atal Px ]>=1980) 7 3880 43. 7680 16 2580 2a 2580 23 2580 32 2500 36 2500 a7 2440 40 2500 41 2500 45-2500 482000 49 2000 Bie 1080 2120 1960 2120 2120 2120 2120 1980 180 1960 1980 2520 2520 6440 Tamean0) npe:folab research google. comidriva/TesqhAX8D yal LBBN7u23TqOGIMXpIGaxbscrollTo=7p5Rg_AKNBSBSpHnIMode=true 105600 102400 «6105600, 5108400 105600 209000 400800 5409800 ‘469600 109400 4891200 5109400 5109400 102400 7257800 7251800 m9 1191728, 350 PM 21..Statistios_Assignment_Day_21.Ipynb -Colaboratory (a Jonedion() 6440" Pa Tamean) 44 Pw Jonedson() Observations: The features "Pa and "Paw are respe the number of pines in the phone sereen inthe vertical ané horizontal axes. We created a new feature called "Px' which s the product ofthe features "Px hand “Px_w ‘The median has been selected as a threshold inthis case, In case it's too set, we can choose the mean as athveshold Task 4 - Obtain the logical conditions for the features “Scr_h" and "Scr_w* npe:folab research google. comidriva/TesqhAX8D yal LBBN7u23TqOGIMXpIGaxbscrollTo=7p5Rg_AKNBSBSpHnIMode=true ane 1191723, 350 PM “ 5 ” ‘0 Bee eeen (2 = 9a.boe npe:folab research google. comidriva/TesqhAX8D yal LBBN7u23TqOGIMXpIGaxbscrollTo=7p5Rg_AKNBSBSpHnIMode=true ErTas70 no yes yes NONI283 yes yes yes NNsDeso1 nono ys POGZUM nono os PELIIIK nono yes PNWOTTL momo yas PoPas@R no yes yes awnezy no yes yes fazesrr0 no yes yes RAVIMEW no yess S0O885S no yes yes SETSSER ro yes yes SEKSBTY yes yes yes SSS0O00L yor yes yes Tvrorey yes ve T0108 m0 vs Tvusa no yor yes Tyvasay yee ves rane (data, colums = (75eh yes yes yes yes 21,.Statistios_Assignment_Day_21.Ipynb -Colaboratory 2500 2000 120 760 2120 1760 1960 1260 2120 1960 1260 2120 2120 2120 0 om 2 2 2 6 128 128 128 2800 3000 2800 4000 400 2000 4800 4500 4500 200 2000 4400 one 1191723, 350 8 6 eo 2 Pet 21,.Statistios_Assignment_Day_21.Ipynb -Colaboratory 1 Create 2 new feature calted “Ser_d” wich stores the Length of the diagonal of the screen of the phone eraser J> mp. sart{ asa 'Ser_h']**2)+(4¢2['Ser_w"]**2)) erzsheast) er2[ Sere] onaant) a eF2('Ser_e J omeatangy npe:folab research google. comidriva/TesqhAX8D yal LBBN7u23TqOGIMXpIGaxbscrollTo=7p5Rg_AKNBSBSpHnIMode=true se2278 2230060 s019 1191723, 350 PM 21..Statistios_Assignment_Day_21.Ipynb -Colaboratory 1 = np.percentile(dtat ‘ser = mp percentile(dra{ ‘Ser 1,25) 1.78) a s.naaassesceasaen ® 1 create 2 Mstogran of the "Ser_d* Feature and alse show the quartiles pit fgure( Figstze = (41,5) Eneihistpioe(sate = of2 x'Scr¢ ple-title("istogran of Sens") ple wlavel(ser-e") ple ylaven(*coure") ple wlines(#f2["Ser_sJ-eean(), ymin pltselines ofa Sera Jueedian(), ymin pit-tegend() pltsshont) color green’ ,e4gecolor = ‘Linen’ alpha = 8.5 bins = 5) ymax = 48, colorse’ green’, Tabel="uppes) (yas = 40, colarse"Black*, dabel="Lower") Histogram of ser 1 The entLéren want phones that have very goad screen sizes 4 Consider the phones that have screen sizes greater than or equal to the upper quartile value in the data set f creace s loptesl condition for thse situstion ang store the logical values #6 "cons" con 8 False 2 false t Fee 6 false a pale io false a2 pale DB ie Mo False npe:folab research google. comidriva/TesqhAX8D yal LBBN7u23TqOGIMXpIGaxbscrollTo=7p5Rg_AKNBSBSpHnIMode=true ni9 1191728, 350 PM 21..Statistios_Assignment_Day_21.Ipynb -Colaboratory Observations: ‘The features "Scr_h' and Scr_w’ are respectively the height and the wiath of the phone screen We created a new feature called "Ser which is essentially the length ofthe sereen diagonal ‘The upper quartile has been selected asa threshold inthis case as the children were very particular on this pont, In casei is too svet, we can choose the mean or the median as a threshold. Task 5 - Obtain the logical conditions for the features "PC" and "FC" npe:folab research google. comidriva/TesqhAX8D yal LBBN7u23TqOGIMXpIGaxbscrollTo=7p5Rg_AKNBSBSpHnIMode=true r9 1191723, 350 PM 14 NaNazes 15 NsDésor 47 Poszun se PELIIK a1 awry 22 azasro 23 RAVAN 25 sp05886 26 SETSGOR 28 ssp000: 33 Tua a Tyvesas 36 usTo00T a7 uszis 41 wuveo2y 44 xmusr8 45 xvsrF ata '9C*.neant) eatalPCJemedion() satalFC°J.neant) ata" J.median() npe:folab research google. comidriva/TesqhAX8D yal LBBN7u23TqOGIMXpIGaxbscrollTo=7p5Rg_AKNBSBSpHnIMode=true yes yes yes yes yes yes vs yes yes yes yes 21,.Statistios_Assignment_Day_21.Ipynb -Colaboratory 2500 2900 2800 2440 2000 2500 2500 120 760 2120 1760 1960 1260 2120 1960 1260 2120 2120 2120 1960 1960 1980 1960 1960 0 8 2 2 2 2 2 6 128 128 ot 16 128 128 128 2 128 128 512 2800 3000 2800 4000 400 2000 800 4500 4500 200 2000 4400 2000 4800 00 4580 2300 139 1191723, 350 PM 21..Statistios_Assignment_Day_21.Ipynb -Colaboratory 1b create a tistogran of the “PC” feature and also show the mean and the nesian ple tigure(igsize = (05,8)) Sns.histplot(data = data plt.title( Hiatopran oF Pe") pltsadabed(") pit-ytaven(*count*) plt.vlines(eatal'PC°].ean(), ynin = @, ymax = 49, colorse"green’, labele"upper") plt-vlines(catalPC°unedian(), ymin = @, ymax = 48, colorse"black’, label="Lower") ple-legend() ple-showt) wolor = “Linen alpha = 0.5 bins = 5) steam oP 1 create a histogram of the "FC" feature and also stow the nean and the wadian pit figure(igesze ~ (5,89) Sns.hiseplot(date ~ deca’ gx ~ 'FC', color"green’,edgecolor = "Tinen',alpha = @.5,bins = 5) ple-tisle(tstopran of Fe") ple-wlavel Fe ple ylavet(*coure") lt-vlines(satal'FC"].sean(), ynin = @, ymax = 48, colorse plt-vlines(aatal‘FC"]umedian(), ymin = @, ymax = 48, color pit. degend() pit ston) npe:folab research google. comidriva/TesqhAX8D yal LBBN7u23TqOGIMXpIGaxbscrollTo=7p5Rg_AKNBSBSpHnIMode=true 149 1191723, 350 PM 21..Statistios_Assignment_Day_21.Ipynb -Colaboratory steam oF cone = aatal(eatal'2C*Jpadatal 20"). mean() 8(satal FC" Jp=datal FC" ).mean())] 12 ETTIe7D no yes yes yas 2800 1980 8S ww 18 POFTEEG nono yek_ yes 2880 18D 8 21 awrezay no yes yes yas 2500 1880s 25 SD0555G no yes yor yos 2880 1880 6H 2m SS0000L yer yes yas yes 7880 2120 «8G ma rvrovay yes yes you yes 2800 2120088 a 32 TYS@IaL yor yes yok yos 7580 2120 «8G A 2 10mH TYUsea no yes yokes 7580 212008 ‘yis3) yes yes yes «yes: 2880 220834 gta 38 Wvss2y yes yes yos,=yos 2580 1600 «Sg ww 40 WERTEST yes yes yas yas 880 198005 ek wa 42 wonzsex yes yes yes yas 580 1988s ok goat 45 rover no yes yos—=yes 2580 198008 wt 4s YIRSTY yes yes yos,—=—yos 2580 1080 ¢ wt 49 722000 yes yous yor, =o 80 2520 8G ta BTR Observations: ‘The features "PC" and FC" are respectively he resolutions ofthe primary camera and the frant camera, ‘The respective means have been selected as thresholds inthis case, In case itis too strict, we can choose the respective medians as thresholds. Task 6 - Obtain the logical conditions for the features "Int_Mem’, “Bty_Pwr' and "RAM" fatal int ten"J meant) fatal Int Mom] nedian() npe:folab research google. comidriva/TesqhAX8D yal LBBN7u23TqOGIMXpIGaxbscrollTo=7p5Rg_AKNBSBSpHnIMode=true 4500 4500 4200 4400 2300 2800 00 6 s919 13173, 3:50PM 21..Statistios_Assignment_Day_21.Ipynb -Colaboratory satalBty_Par"] meant) cata ty_par"J median) ata HA Tonean0) ata UN Jonedson() ple-tigure(igsize = (25,8) fEne.histplon(sate ~ dota jx ~ “Int fen’, colors'rea! eseecolon = ‘Linen’ alpha = @.5,0in8 ~ 5) ple-title("wistogran of Injen") plt-xdaved ("Int_fee") ple-ylaven(*coure") ple wlines(satal Tat Men" J.ncan(), yin = @, ymax « 100, colorse'blue’, 1abele"ypper") pit viines(satal Tee Men’ }-median(), yan = 8, ymax = 168, colorss"yeliow", labels Lower") pit degend() plt-stont) npe:folab research google. comidriva/TesqhAX8D yal LBBN7u23TqOGIMXpIGaxbscrollTo=7p5Rg_AKNBSBSpHnIMode=true tert wen a 2 Mstogran of the "type" feature ang algo show the mean and the radsan Figure(tiasize ~ (35,8)) histplot(data = esta ;x = “Bty.Par', color="yellow’jedgecolor = "Iknen' alpha = @.5,bin= = 8) title( Histopran of Int_yen") wtavel( "ay. Por") ylaved(*caunt") ‘Lines (ata "Bey Par") nean(), ynin = 0, yaax = 50, colorse"biue', labele‘upper") vLines(aatal’ty_Par*].nedian(), ymin = 8, yhax = 50, colorse"red', Label~'Lover*) egend() shout) 1619 1191723, 350 PM 21..Statistios_Assignment_Day_21.Ipynb -Colaboratory steam er 1 create a nistogran of the "RAN" feature and also show the mean and the nectan ple-tigure(figsize = (15,8)) Sns.histplor(data = deca’ x = ‘RAW, colore'green'edgecolor = ‘Tinen',alpha = @. ie ple-ylasen(*coure") plt-vlines(satal RAM ].mean(), ymin = 8, ya = 50, colors="biue’, Label="upper") plt.vLines datal Ran" Jomadian(), ynin = @, ymax = $8, colorse"red’, label="Lower") plt-legend() ple-stowt) bine =) stern et mt 1 The ehigren want phones that have good internal menory, battery power and Ret "Consider the phones that have internal menary, battery sower and MAM greater than or equal to thelr respective mean values 1 create a logical condition for this situation ang store the Logical values 26 "con3" cons = datel(éata{"Int_en']>edata{"Int_ on] nean())8(6atal Bty_Par'}>adatalBty_ Par’ }emean())&(datal "RA" ]>mdsea RAH] .nean())) npe:folab research google. comidriva/TesqhAX8D yal LBBN7u23TqOGIMXpIGaxbscrollTo=7p5Rg_AKNBSBSpHnIMode=true amie 1191723, 350 PM 21..Statistios_Assignment_Day_21.Ipynb -Colaboratory aa TWFOTEY yes yes yon yes 2500 2120 «8G teat 52 TYS9S8L_ yes yoo yon =yen 2580 2120 «88 BH tomate 42 w2s200K yes yen yes—=—yes 2580 19808 GA 32 toms sang 47 ZOFTBK yo yes yes ce oa Observations ‘The features “nt. Mem, Biy_Pw" and "RAM" are respectively the intemal memory, battery power and RAM ofthe phones. ‘The respective means have been selected as thresholds inthis case, In case Its too strict, we ean choose the respective medians as thresholds Task 7 - Obtain the logical conditions for the features "Depth and "Weight" satal Depth) -reand) 3ta[ Depth’ J rectant) satal Wesghe"]-nean() satal Weight) -nedtan() 1 Create 2 nistogran of the “Oe ple-Figure(figsize = (25,8) Sns.histplot(eata = esta’ x = ‘Depth’, colora'green’sedgecolor = ‘Linen’ alpha = 6.5,0ins = 5) ple-title("istogran of Dept’) ple slaved oepth") ple ylaven count") Ple-vidnes sata Depth’ }.nean(), yin = @, yabe = $8, colorse"blue', labele"uprer plt.vlines(datal Depth" Jnedian(), ymin =/@, ynax = 58, colorse‘red", labele"Lower") pit tegend() ple stent) npe:folab research google. comidriva/TesqhAX8D yal LBBN7u23TqOGIMXpIGaxbscrollTo=7p5Rg_AKNBSBSpHnIMode=true rane 1191723, 350 PM 21..Statistios_Assignment_Day_21.Ipynb -Colaboratory steam Degen pit Figure(Figsize = (35,8) fnsihiatplot(date = data jx = “Weight", colora‘red"edgecolor = ‘Linen’ alpha = @.5,bine = 5) PLL Uitle("Histograe oF KeLghe”) pltadavel("weighe") plt-ylaved(‘Coure') ple-vldnes (cata wet ple vlines oat weight ple legend) ple-stont) rean(), ynin = @, yx = 58, 60 edian()y ynin = 8s yma = 5 jorse'olue", Labels" upper”) colorse"yeliow', Iabel=" (over) etoyam ot eh # Consider tne phones shat have cepth and weight Less shin or equsl to the cespective nedian values in the date set oné = datal(Sata[Depeh’]>udata|'Septh’ Junedian(})&CdataL hetent”]>datal “ketene” ]-redsan())] npe:folab research google. comidriva/TesqhAX8D yal LBBN7u23TqOGIMXpIGaxbscrollTo=7p5Rg_AKNBSBSpHnIMode=true 1919

You might also like