Skip to content

Python Data Science Toolbox (Part 2)

Run the hidden code cell below to import the data used in this course.


1 hidden cell

Take Notes

Add notes about the concepts you've learned and code cells with code you want to keep.

Add your notes here

# Add your code snippets here

Explore Datasets

Use the DataFrames imported in the first cell to explore the data and practice your skills!

  • Create a zip object containing the CountryName and CountryCode columns in world_ind. Unpack the resulting zip object and print the tuple values.
  • Use a list comprehension to extract the first 25 characters of the text column of the tweets DataFrame provided that the tweet is not a retweet (i.e., starts with "RT").
  • Create an iterable reader object so that you can use next() to read datasets/world_ind_pop_data.csv in chunks of 20.

List comprehensions

fellowship = ['frodo', 'samwise', 'merry', 'aragorn', 'legolas', 'boromir', 'gimli']

# Create list comprehension: new_fellowship
new_fellowship = [member if len(member) >= 7 else '' for member in fellowship]

# Print the new list
print(new_fellowship)