โ† All Data Science with Python Certification Flashcard Decks

Data Science with Python Pandas DataFrame Operations Flashcards

7 cards from real Data Science with Python Certification practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 Data Science with Python Pandas DataFrame Operations flashcards as text
  1. Which method returns the number of non-null values in each column of a DataFrame?

    Answer: df.count()

    df.count() returns the count of non-null values per column by default.

  2. What does df.pivot_table(values='sales', index='region', aggfunc='mean') compute?

    Answer: Mean sales per region

    The aggfunc='mean' parameter computes the average of the 'sales' column grouped by 'region'.

  3. How do you rename columns 'a' and 'b' to 'x' and 'y' in a DataFrame df?

    Answer: df.rename(columns={'a':'x','b':'y'})

    df.rename(columns={...}) accepts a mapping dict via the columns keyword argument.

  4. What is the result of df.duplicated() on a DataFrame?

    Answer: Returns a boolean Series marking duplicate rows

    df.duplicated() returns a boolean Series where True indicates a row is a duplicate of a previous row.

  5. Which of the following correctly filters rows where column 'age' is between 18 and 35 (inclusive)?

    Answer: df[df['age'].between(18, 35)]

    The .between(left, right) method returns True for values within the inclusive range.

  6. What does df.melt(id_vars=['id'], value_vars=['q1','q2']) do?

    Answer: Transforms wide data to long format

    df.melt() unpivots a DataFrame from wide to long format, keeping id_vars fixed and stacking value_vars.

  7. How do you compute a rolling 7-day mean on column 'price' in a DataFrame df?

    Answer: df['price'].rolling(7).mean()

    rolling(7).mean() computes a sliding window average over 7 consecutive observations.

How this page was made: written with AI tools and published by Nathan Beja, founder of Practice Test Geeks, who is responsible for its content. We have not yet matched this exam's facts to an official source, so confirm fees, dates and rules with the exam body. Not reviewed by a subject-matter expert. Editorial policy