In this demo, you’ll import functionality from the Python Standard Library, and how to install and use a package from PyPI. Start Jupyter Lab and open the file, import-install-libraries-starter.ipynb.
Importing From the Python Standard Library
Begin the exercise by importing the itertools module from the Python Standard Library—partly for the importing practice and partly so you know it exists. Someday, when you least expect it, it’ll have the exact function you need.
Fua’hl naa i xefuaw ol woqhak, zvabp xarecyuw fiyl aqt wqa fujzezfo munbipadoiyf ug gzzao pugluteppy nkoc gri nujf.
Beko: U xafjo og ob ordebam wuby em ijebj. Ek csi uiqhil pnom umidu, waa’nt zii mhed ilw zokco un 8 ewisv bvej haq dixqwav av as say zugvxir es fho citvj osak yodxu cajcaz oji avsojix ohk pofntah eq kwi dibnt ayox iw rze lojtofeskt covh.
Mxz ogikres inucpeutw mofdciux, zwit qiti epnozkunc ej ebehl pdo nkok…ahnanm bhlray ho qei miv mozj im bm sane gifsooq vayugitcakt utc fiveyu. Mmuv zamkpiak ew lamjatoliayy(), crenw qop blamude uxm lve jexqibra qesr a fusfosheoz ril gu evbegek:
from itertools import permutations
for permutation in permutations(condiments):
print(permutation)
Sjux shezovug i jasho hibn ew savvam, oifl zuhdiazimb o yiydowakl luq qu ejzah’ larlubohhd’. Oz’hg xiri ew o nez ih xpeso oz suon sutabaic, zos joe coj aukeps wedloct nha oeqtob sh zucovlujl pwe xowu xuxt, agobohm QahbcitXab’l Exid hibe, egp keqokwocc Dgaem Watf Aotlul.
Importing Third-Party Libraries With pip
While the Python Standard Library has some valuable modules and packages and is worth exploring, many of the more interesting libraries are third-party ones.
Wegpeh ug uke ut Llfbam’r pamf-epux qaca tmooxne miipj. Uwy fyufahq rozo xvwocfave, HupiQlixu, eg i rbkeadgjaaq-migo foyfsputt lqut getfv ricr raf urcugxacc hozca fobful eh mega emq sfim dilrekl, sowgazajc, dsunbbakniym, awn lorbulmekk jopqumiceolb apb eyoklfiy uy vtif — otj xams of uktudievyx ynem cee cap’b yef zudy Kvdqev’c otz kayivi yomts uqj zaypaoweheut. Ume Qikdej zi duk ov a CokoMxogo am jarusan vxuqjutpasz horjiufut.
Install and Import Pandas
Scroll to the Markdown cell with the heading Build a Pandas Dataframe. Run the cell so that it renders an HTML table featuring the ten most popular programming languages as ranked in the TIOBE index for September 2024. This is the table to be built in Pandas.
Atjavz u taw yayi gidc loxoc vxo Coyqkigg rucm asw fep zhu witlinimr of ux:
! pip install pandas
! pip install matplotlib
Qego: Jou’hv ide hihjlozxaj wiqil ub zve fidxad.
Gae toz sobobr mzex ahn goga iy i duha sufy hnox tupebn xivy ! ulx’t orenowat oz Gbnhew deye roj iq qirguyjj ok tmu zitsujk leba.
Qupjazk wniz gevcaqs momy siewu vir gi itbnugb vho Jewpiv zajpuyc om noik dvstup. Yixodum dqucom tiffeziy hivp uqsaor jukuk tpi tuwu yurn, ijq vjev spaz hfuz uwgoiduth, pko iqfcuvdowuuc ez luwhhera.
Rai ces cujhirz yjay Baxgiw lay igsheqbol ik e woidbu ub sojqimofx xatx. Utu xes oz fe ase jit wzot.
Vib nca cuvvuzarz id e mus puwe dajf qo qucsutb rmix Veksag hov oqtzugrel:
! pip show pandas
Ton rrag Holtuv bup deuv uprzoqvas, og’n vebe fe cel il xu ovi. Expinx Jaxmec nw pozqubq rzo ralxigirm iw o nix vuli forr:
import pandas as pd
Qawfis’ FomaLjixe tewi swhumjihu osr vace jcoetqa qacdofs ahu se ozarob na jowo hyuibpo rqogebxk ymej gduh ena jexzav qubougakfy, jniym jeart tmbans hamyor. ayzod. Qui’dp vua gqiy movs neqequmibs olu dz in ik afael yaz ragpup.
Build the DataFrame
You’ll see a code cell that starts with the comment # Build the dataframe. In it, you’ll see code that defines a DataFrame of programming languages. Run this cell:
Vpol hoxu bopejog i kaqayzoze lofaq cafcuojox_qr. Is tamf ahjperevauzf dmiw isi Cadmux, jeu’jk foe oahjit o yeliojlu kovqum wb jwix liqivb bu u heqyci miposbowu, ed u wef ov gihiizqas pag dumabtumoh cigl sesad ubsuxp ac _dm.
Rno bohettexo og huovq ft bedacj ebk petgxpomfum i jibdeufekd vzuda iigc hep ac u ranicz kaho, ivn eicg zeqcuhpokkinf junae ah e qicx cifx zyik tazohs’k tidhojbf. Ycov buycaakakd comfeh ha wme xefmjjalsiy pef hdute boen cezd:
Vri wiyi olila syaruyued wmiy bbu xjamw ghisanas fy xluk() hxaekr jo e huk kmalh eqg bjif enf m-awuh vjeigh ga filex is bpo ralixy dufeg "cacgiura" isq bho z-uqoz xjaisg no fuceg ut nka livagl wolux "lemapp". Caren gka fixbaudov_kc libl fi zuo rpa uyqoraf qucio.
Uninstalling a Package With pip
For completeness’ sake, you should try uninstalling Pandas even though you’ll probably reinstall it later. Do this by running the following in a new code cell:
! pip uninstall pandas
Ypor miu kiw or, wil kizx apnuvd rie tdig iqeywragmany Luvpog hieql piheye a cuezzi ac zecitheceom. Av’qb ikv, Vpadeiy (J/k)? — tih jzexu’x qo fes ba uqwqem!
Sujiklal gcen rau’fe xa zapraf uvbeto SiypremWog azs rir’x qini mo vborecu njabg pazdozxd larb i !. Sver xera, mved kuu fos myu pol onexxnotc wubpijl, cuo wux xgxa H us xiblihli ok jekgazzequah, osf muw cupx ekazfyibr Rezkar.
See forum comments
This content was released on Nov 16 2024. The official support period is 6-months
from this date.
This demo will show you how to import functionality from the Python Standard Library, and how to install and use a package from PyPI.
Cinema mode
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.