Python for Data Analysis

Python for Data Analysis

Practise the Python data workflow: load files, inspect DataFrames, clean messy columns, group and join data, handle dates, use NumPy, plot results, and debug common mistakes.

Recommended next

156 questions ready

Start with a quiz

Answer from memory first, then review the rationales and revisit weak areas from this course.

Activities

Quiz156 Questions
Flashcards161 Cards
Study Notes12 Notes
Mind Map4 Maps

List of Questions30 questions
  1. Question 1
    • Performs standard division and returns a float
    • Calculates the remainder of a division
    • Performs floor division and returns an integer result
    • Raises a number to a power
  2. Question 2
    • my_list = [1, 2, 3]
    • my_list = (1, 2, 3)
    • my_list = {1, 2, 3}
    • my_list = <1, 2, 3>
  3. Question 3
    • IndexError: string index out of range
    • 'P'
    • 'n'
    • 'o'
  4. Question 4
    • It returns None
    • It raises a NameError
    • It raises a SyntaxError
    • It automatically creates a new variable with a value of 0
  5. Question 5
    • x == 5
    • x := 5
    • x -> 5
    • x = 5
  6. Question 6
    • The number of elements in the list
    • The data type of the list
    • The memory size of the list in bytes
    • The index of the last element
  7. Question 7
    • func my_func():
    • define my_func():
    • def my_func():
    • function my_func():
  8. Question 8
    • Tuples can only contain numbers
    • Lists cannot be indexed
    • Lists are mutable, tuples are immutable
    • Lists are immutable, tuples are mutable
  9. Question 9
    • [0, 1, 2, 3, 4]
    • [5, 6, 7, 8, 9, 10]
    • An error because range requires a single argument
    • [5, 6, 7, 8, 9]
  10. Question 10
    • 2
    • KeyError
    • 4
    • 3
  11. Question 11
    • {'Alice': 10, 'Bob': 8, 'Charlie': 7}
    • {'Alice': 10, 'Bob': 5, 'Charlie': 7}
    • Error: dictionary changed size during iteration
    • {'Alice': 10, 'Bob': 8}
  12. Question 12
    • France
    • None
    • KeyError
    • True
  13. Question 13
    • 150
    • 120
    • 90
    • 60
  14. Question 14
    • 5
    • 3
    • 7
    • 2
  15. Question 15
    • 4
    • KeyError
    • 3
    • 2
  16. Question 16
    • Installs the pandas library
    • Reads a CSV file into a pandas DataFrame
    • Creates a new pandas DataFrame
    • Imports the pandas library and gives it the alias pd
  17. Question 17
    • pd.open_csv()
    • pd.load_csv()
    • pd.read_csv()
    • pd.import_csv()
  18. Question 18
    • df.tail(8)
    • df.head(8)
    • df.top(8)
    • df.first(8)
  19. Question 19
    • df.details()
    • df.summary()
    • df.info()
    • df.describe()
  20. Question 20
    • A list of all unique values in the DataFrame
    • The data type of each column in the DataFrame
    • The number of rows in the DataFrame
    • The shape of the DataFrame as a tuple
  21. Question 21
    • df.export_excel()
    • df.save_excel()
    • df.to_excel()
    • df.write_excel()
  22. Question 22
    • To measure the memory usage of the DataFrame
    • To delete the last few rows of the DataFrame
    • To display the first n rows of a DataFrame for inspection
    • To calculate summary statistics for all numeric columns
  23. Question 23
    • int64
    • bool
    • object
    • float64
  24. Question 24
    • df.columns
    • df.dtypes
    • df.index
    • df.shape
  25. Question 25
    • missing_values='N/A'
    • na_values='N/A'
    • fillna='N/A'
    • null_values='N/A'
  26. Question 26
    • Those columns contain missing values.
    • The data types of those columns are incorrect.
    • The DataFrame has duplicate rows.
    • The CSV file had inconsistent delimiters in those columns.
  27. Question 27
    • df.info()
    • df.sample(5)
    • df.describe()
    • df.dtypes
  28. Question 28
    • The index is saved as a separate column without a header.
    • The index is saved as a separate column with a header.
    • The index is saved as the first row of the file.
    • The index is not saved.
  29. Question 29
    • A random sample of three rows from the end of the DataFrame.
    • The first three rows of the DataFrame.
    • The last three rows of the DataFrame.
    • The last three columns of the DataFrame.
  30. Question 30
    • skiprows=1
    • header=None
    • no_header=True
    • names=False
List of Flashcards161 flashcards

Flashcards will appear here once they are ready.