Pandas Brain Teasers by Miki Tebeka
Author:Miki Tebeka [Miki Tebeka]
Language: eng
Format: epub
Publisher: Pragmatic Bookshelf
Published: 2021-08-30T00:00:00+00:00
Further Reading
Returning a View Versus a Copy in the Pandas Documentation
http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
DataFrame.loc Documentation
http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.loc.html
Puzzle 14 A Tale of One City
population.py
â âimportâ âpandasâ âasâ âpdâ
â
â cities = pd.DataFrame([
â (â'Vienna'â, â'Austria'â, 1_899_055),
â (â'Sofia'â, â'Bulgaria'â, 1_238_438),
â (â'TekirdaÄ'â, â'Turkey'â, 1_055_412),
â ], columns=[â'City'â, â'Country'â, â'Population'â])
â
â
â âdefâ âpopulation_ofâ(city):
â âreturnâ cities[cities[â'City'â] == city][â'Population'â]
â
â
â city = â'TekirdagÌ'â
â âprintâ(population_of(city))
Guess the Output
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Hello! Python by Anthony Briggs(9373)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9343)
The Mikado Method by Ola Ellnestam Daniel Brolund(9307)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(7852)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7402)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7323)
Grails in Action by Glen Smith Peter Ledbrook(7295)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7116)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(5957)
Kotlin in Action by Dmitry Jemerov(4638)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(3885)
Functional Programming in JavaScript by Mantyla Dan(3723)
Learning Java by Patrick Niemeyer & Daniel Leuck(2871)
Learning React: Functional Web Development with React and Redux by Banks Alex & Porcello Eve(2838)
Mastering Python for Finance by Weiming James Ma;(2838)
Windows APT Warfare by Sheng-Hao Ma(2603)
WordPress Plugin Development Cookbook by Yannick Lefebvre(2602)
Mastering Java 9 by Dr. Edward Lavieri(2573)
Architecting Modern Java EE Applications: Designing lightweight, business-oriented enterprise applications in the age of cloud, containers, and Java EE 8 by Daschner Sebastian(2558)