Python Toolbox
Continue to build your modern Data Science skills by learning about iterators and list comprehensions.
Start Course for Free4 hours12 videos46 exercises283,972 learnersStatement of Accomplishment
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.Training 2 or more people?
Try DataCamp for BusinessLoved by learners at thousands of companies
Course Description
In this Python Toolbox course, you'll continue to build more advanced Python skills. First, you'll learn about iterators, objects you have already encountered in the context of for loops. You'll then learn about list comprehensions, which are extremely handy tools for all data professionals and developers working in Python. You'll end the course by working through a case study in which you'll apply all the techniques you learned in both parts of this course.
Training 2 or more people?
Get your team access to the full DataCamp platform, including all the features.In the following Tracks
Associate Python Developer
Go To TrackPython Programming Fundamentals
Go To Track- 1
Using iterators in PythonLand
FreeYou'll learn all about iterators and iterables, which you have already worked with when writing for loops. You'll learn some handy functions that will allow you to effectively work with iterators. And you’ll finish the chapter with a use case that is pertinent to the world of data science and dealing with large amounts of data—in this case, data from Twitter that you will load in chunks using iterators.
Introduction to iterators50 xpIterators vs. Iterables50 xpIterating over iterables (1)100 xpIterating over iterables (2)100 xpIterators as function arguments100 xpPlaying with iterators50 xpUsing enumerate100 xpUsing zip100 xpUsing * and zip to 'unzip'100 xpUsing iterators to load large files into memory50 xpProcessing large amounts of Twitter data100 xpExtracting information for large amounts of Twitter data100 xpCongratulations!50 xp - 2
List comprehensions and generators
In this chapter, you'll build on your knowledge of iterators and be introduced to list comprehensions, which allow you to create complicated lists—and lists of lists—in one line of code! List comprehensions can dramatically simplify your code and make it more efficient, and will become a vital part of your Python toolbox. You'll then learn about generators, which are extremely helpful when working with large sequences of data that you may not want to store in memory, but instead generate on the fly.
List comprehensions50 xpWrite a basic list comprehension50 xpList comprehension over iterables50 xpWriting list comprehensions100 xpNested list comprehensions100 xpAdvanced comprehensions50 xpUsing conditionals in comprehensions (1)100 xpUsing conditionals in comprehensions (2)100 xpDict comprehensions100 xpIntroduction to generator expressions50 xpList comprehensions vs. generators50 xpWrite your own generator expressions100 xpChanging the output in generator expressions100 xpBuild a generator100 xpWrapping up comprehensions and generators.50 xpList comprehensions for time-stamped data100 xpConditional list comprehensions for time-stamped data100 xp - 3
Bringing it all together!
This chapter will allow you to apply your newly acquired skills toward wrangling and extracting meaningful information from a real-world dataset—the World Bank's World Development Indicators. You'll have the chance to write your own functions and list comprehensions as you work with iterators and generators to solidify your Python chops.
Welcome to the case study!50 xpZipping dictionaries100 xpWriting a function to help you100 xpUsing a list comprehension100 xpTurning this all into a DataFrame100 xpUsing Python generators for streaming data50 xpProcessing data in chunks (1)100 xpWriting a generator to load data in chunks (2)100 xpWriting a generator to load data in chunks (3)100 xpUsing pandas' read_csv iterator for streaming data50 xpWriting an iterator to load data in chunks (1)100 xpWriting an iterator to load data in chunks (2)100 xpWriting an iterator to load data in chunks (3)100 xpWriting an iterator to load data in chunks (4)100 xpWriting an iterator to load data in chunks (5)100 xpFinal thoughts50 xp
Training 2 or more people?
Get your team access to the full DataCamp platform, including all the features.In the following Tracks
Associate Python Developer
Go To TrackPython Programming Fundamentals
Go To Trackcollaborators
prerequisites
Introduction to Functions in PythonHugo Bowne-Anderson
See MoreData Scientist
Hugo is a data scientist, educator, writer and podcaster formerly at DataCamp. His main interests are promoting data & AI literacy, helping to spread data skills through organizations and society and doing amateur stand up comedy in NYC. If you want to know what he likes to talk about, definitely check out DataFramed, the DataCamp podcast, which he hosted and produced.
FAQs
Join over 15 million learners and start Python Toolbox today!
Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.