mwouts/world_bank_data: The World Bank Data in Python

文章推薦指數: 80 %
投票人數:10人

The World Bank Data in Python. Contribute to mwouts/world_bank_data development by creating an account on GitHub. Skiptocontent {{message}} mwouts / world_bank_data Public Notifications Fork 30 Star 89 TheWorldBankDatainPython MITLicense 89 stars 30 forks Star Notifications Code Issues 2 Pullrequests 0 Actions Projects 0 Security Insights More Code Issues Pullrequests Actions Projects Security Insights Thiscommitdoesnotbelongtoanybranchonthisrepository,andmaybelongtoaforkoutsideoftherepository. master Branches Tags Couldnotloadbranches Nothingtoshow {{refName}} default Couldnotloadtags Nothingtoshow {{refName}} default 3 branches 4 tags Code Latestcommit   Gitstats 79 commits Files Permalink Failedtoloadlatestcommitinformation. Type Name Latestcommitmessage Committime .github/workflows     binder     examples     tests     world_bank_data     .gitignore     .pylintrc     .travis.yml     CHANGELOG.md     LICENSE     MANIFEST.in     README.md     codecov.yml     environment.yml     requirements-dev.txt     requirements.txt     setup.cfg     setup.py     Viewcode TheWorldBankDatainPython Quicktutorial Installation Getthelistofsources,topics,countries,regions Getthelistofindicators Searchingforonecountryorindicator Getthevaluesofanindicator Readyforaninterativetutorial? References TheWorldBank Google'sPublicDataExplorer Python R FAQ Countryandindicatordescriptioninnon-Englishlanguages Caching Usingbehindaproxy License README.md TheWorldBankDatainPython ThisisanimplementationoftheWorldBankAPIv2inPython.UsethispackagetoexploretheWorldDevelopmentIndicatorspublishedbytheWorldBank. Quicktutorial Installation InstallorupdatetheWorldBankDatapythonpackagewith pipinstallworld_bank_data--upgrade Getthelistofsources,topics,countries,regions importpandasaspd importworld_bank_dataaswb pd.set_option('display.max_rows',6) Thelistoftopicsisavailablewith wb.get_topics() Sourcesarereturnedby wb.get_sources() Andfinally,thelistofcountriesisaccessiblewith wb.get_countries() Inaddition,giveatryto get_regions get_incomelevels get_lendingtypes toretrievemoreinformationaboutcountryclassifiers. Getthelistofindicators Thisisdonewiththeget_indicatorsfunction.Youmayqueryonlytheindicatorsforaspecificsourceortopicasbelow.Ifyouinputnoarguments,theget_indicatorfunctionwillreturnthedescriptionofallthe16,000+indicators. wb.get_indicators(topic=3,source=2)#topicandsourceidarefromget_topics/get_sources Requestingallindicatorsmaytakeafewseconds,butnoworries,theresultiscached,sonexttimethiswillbeinstantaneous. Searchingforonecountryorindicator Usethefunctionssearch_countries,search_source,search_indicators.Or,ifyouwanttosearchinaexistingdataframe,simplyusesearch. wb.search_indicators('mathematics') Getthevaluesofanindicator Thefunctionget_seriesreturnsthevalueofasingleindicator.TheWorldBankAPIacceptsquiteafewarguments,including: mrv,integer:oneormoremostrecentvalues date,string:eitheroneyear,ortwoyearsseparatedwithacolon,like'2010:2018' gapfill,string:'Y'or'N'(thedefault):forwardfillsmissingvalues. Forinstance,thecallbelowreturnsthemostrecentestimatefortheWorldPopulation: wb.get_series('SP.POP.TOTL',mrv=1) Theresultabovehasa3-dimensionalindex.Usetheargumentsimplify_indextoignorethedimensionsthattakeasinglevalue(here:yearandseries).Also,usetheargumentid_or_value='id'ifyoupreferyourdatatobeindexedbythecodesratherthanlabels: wb.get_series('SP.POP.TOTL',date='2016',id_or_value='id',simplify_index=True) Readyforaninterativetutorial? GotoourBinderandruneitherthisREADME,orourothertutorialwiththecoderequiredtoproducethisplotoftheWorldPopulation: References TheWorldBank TheWorldBankhasaDataCatalog,andaninteractivedataexplorer. Thirdpartyapplicationsthatallowtoaccessthedatafromvariouslanguagesarelistedhere. Google'sPublicDataExplorer TheWorldBankdataisalsoavailableinGoogle'sDataExplorer. Python Alternativelytoworld_bank_data,Pythonusersmayfindusefulthefollowingpackages: wbpy,nicelydocumentedbutlastreleasedin2013. wbdata,whichworkswell. pandas_datareader ThereasonforwhichIwroteworld_bank_dataismostlyspeed,e.g.IwantedtousethelastestversionoftheWorldBankAPI(v2)andbenefitfromsignificantspeedimprovements.ReimplementingtheAPIalsogavemeafinercontrolonthemappingofoptions. R RuserscanusetwopackagestoaccesstheWorldBankdata: WDI wbstats SeealsotheIntroductiontothewbstatsR-package,orthisquickreviewofthetwopackages. FAQ Countryandindicatordescriptioninnon-Englishlanguages TheWorldBankdescribestheirsourcesandindicatorsinotherlanguagesthanEnglish.Useeitherthelanguageargumentineachofget_countries,get_indicators,etc,orchangethedefaultglobally: wb.options.language='vi' wb.get_indicators('SP.POP.TOTL') wb.options.language='en' Caching Allrequests,exceptget_series,arecachedusingaleastrecentlyusedcachefromthecachetoolspackage. Usingbehindaproxy Usingthepackagebehindanhttpproxyispossible.Useeithertheproxiesargumentintheget_*functions,orsettheproxygloballywithe.g.: wb.options.proxies={'http':'http://example.com:3128'} License ThispythonpackageislicencedundertheMITLicense. PleasealsoreadtheWorldBankTermsofUserelativetotheconditionsthatapplytothedatadownloadedwiththispackage. About TheWorldBankDatainPython Resources Readme License MITLicense Stars 89 stars Watchers 12 watching Forks 30 forks Releases 4 Version0.1.3 Latest Jul9,2019 +3releases Packages0 Nopackagespublished Languages Python 99.3% Shell 0.7% Youcan’tperformthatactionatthistime. Yousignedinwithanothertaborwindow.Reloadtorefreshyoursession. Yousignedoutinanothertaborwindow.Reloadtorefreshyoursession.



請為這篇文章評分?