Test your knowledge: Dataframes with pandas

11. Fill in the blank: In pandas, a _____ is a one-dimensional, labeled array.

  • dataframe
  • series
  • CSV file
  • key

12. In pandas, what is Boolean masking used for?

  • Merging data in a dataframe
  • Adding data to a dataframe
  • Filtering data in a dataframe
  • Deleting data from a dataframe

13. What is a pandas method that groups rows of a dataframe together based on their values at one or more columns?

  • groupby()
  • keys()
  • values()
  • agg()

14. A data professional wants to join two dataframes together. The dataframes contain identically formatted data that needs to be combined vertically. What pandas function can the data professional use to join the dataframes?

  • concat()
  • type()
  • insert()
  • merge()

Weekly challenge 4

15. Fill in the blank: In Python, _____ indicate where a list starts and ends.

  • square brackets
  • braces
  • quotation marks
  • parentheses

16. A data professional is working with a list named cities that contains data on global cities. What Python code can they use to add the string 'Tokyo' to the end of the list?

  • cities.append(‘Tokyo’)
  • cities.import(‘Tokyo’)
  • cities.pop(‘Tokyo’)
  • cities.insert(‘Tokyo’)

17. In Python, which of the following characters can a data professional use to instantiate a tuple?

  • { }
  • < >
  • ( ) 
  • [ ]

18. Which of the following statements accurately describe Python dictionaries? Select all that apply.

  • Dictionaries are instantiated with quotation marks.
  • Dictionaries consist of collections of key-value pairs.
  • Dictionaries are unordered.
  • Dictionaries are ordered.

Shuffle Q/A 2

19. A data professional is working with a dictionary named employees that contains employee data for a healthcare company. What Python code can they use to retrieve both the dictionary’s keys and values?

  • employees.keys()
  • items.employees()
  • employees.items()
  • keys.employees()

20. A data professional is working with two Python sets. What function can they use to find the elements that the two sets have in common?

  • union()
  • intersection()
  • difference()
  • symmetric_difference()

Leave a Reply