Bird
Raised Fist0
Agentic AIml~20 mins

Data analysis agent pipeline in Agentic AI - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Data Analysis Agent Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Output of a simple data filtering step in an agent pipeline
Consider an agent pipeline that filters a dataset to include only rows where the value in column 'age' is greater than 30. What is the output DataFrame after this filtering?
Agentic AI
import pandas as pd

data = pd.DataFrame({'name': ['Alice', 'Bob', 'Charlie', 'David'], 'age': [25, 35, 30, 40]})
filtered_data = data[data['age'] > 30]
print(filtered_data)
A
    name  age
0  Alice   25
2  Charlie 30
B
    name  age
1    Bob   35
3  David   40
C
    name  age
1    Bob   35
2  Charlie 30
3  David  40
D
Empty DataFrame
Columns: [name, age]
Index: []
Attempts:
2 left
💡 Hint
Remember the condition is strictly greater than 30, so age 30 is excluded.
data_output
intermediate
2:00remaining
Result of aggregation in a data analysis pipeline
An agent pipeline groups data by 'department' and calculates the average salary. What is the resulting DataFrame?
Agentic AI
import pandas as pd

data = pd.DataFrame({'department': ['HR', 'IT', 'HR', 'IT', 'Finance'], 'salary': [50000, 60000, 55000, 65000, 70000]})
grouped = data.groupby('department')['salary'].mean().reset_index()
print(grouped)
A
  department   salary
0   Finance  70000.0
1        HR  52500.0
2        IT  62500.0
B
  department   salary
0   Finance  60000.0
1        HR  55000.0
2        IT  65000.0
C
  department   salary
0   Finance  70000
1        HR  105000
2        IT  125000
D
  department   salary
0   Finance  70000.0
1        HR  55000.0
2        IT  60000.0
Attempts:
2 left
💡 Hint
Average salary means sum of salaries divided by count per department.
visualization
advanced
3:00remaining
Identify the correct plot output from a data analysis agent pipeline
An agent pipeline creates a bar plot showing total sales per product category. Which option correctly describes the plot output?
Agentic AI
import pandas as pd
import matplotlib.pyplot as plt

data = pd.DataFrame({'category': ['A', 'B', 'A', 'C', 'B'], 'sales': [100, 200, 150, 300, 250]})
totals = data.groupby('category')['sales'].sum()
totals.plot(kind='bar')
plt.show()
AA bar chart with categories A, B, C on x-axis and bars showing sales totals 250, 450, 300 respectively.
BA line chart with categories A, B, C on x-axis and sales totals 100, 200, 300 respectively.
CA pie chart showing sales distribution with slices for categories A, B, C with values 100, 200, 300.
DA scatter plot with sales on x-axis and categories on y-axis.
Attempts:
2 left
💡 Hint
Sum sales per category: A=100+150=250, B=200+250=450, C=300.
🔧 Debug
advanced
2:00remaining
Identify the error in a data cleaning step of an agent pipeline
An agent pipeline tries to fill missing values in a DataFrame column 'score' with the mean score but raises an error. What is the error?
Agentic AI
import pandas as pd

data = pd.DataFrame({'score': [10, None, 30, None, 50]})
mean_score = data['score'].mean()
data['score'] = data['score'].fillna(mean_score())
print(data)
ANo error, outputs filled DataFrame
BKeyError: 'score' not found
CValueError: cannot convert float NaN to integer
DTypeError: 'float' object is not callable
Attempts:
2 left
💡 Hint
Check how mean_score is used in fillna.
🚀 Application
expert
3:00remaining
Determine the final output of a multi-step data analysis agent pipeline
An agent pipeline performs these steps on a DataFrame: 1) filters rows where 'value' > 10, 2) creates a new column 'value_squared' as square of 'value', 3) groups by 'category' and sums 'value_squared'. What is the final output DataFrame?
Agentic AI
import pandas as pd

data = pd.DataFrame({'category': ['X', 'Y', 'X', 'Y', 'Z'], 'value': [5, 15, 20, 8, 25]})
filtered = data[data['value'] > 10]
filtered['value_squared'] = filtered['value'] ** 2
grouped = filtered.groupby('category')['value_squared'].sum().reset_index()
print(grouped)
A
  category  value_squared
0        X           400
1        Y           64
2        Z           625
B
  category  value_squared
0        X           425
1        Y           225
2        Z           625
C
  category  value_squared
0        X           400
1        Y           225
2        Z           625
D
  category  value_squared
0        X           400
1        Y           225
Attempts:
2 left
💡 Hint
Calculate squares only for values > 10, then sum per category.

Practice

(1/5)
1. What is the main purpose of a data analysis agent pipeline?
easy
A. To store data in a database
B. To organize multiple data steps into one automated flow
C. To create visual charts manually
D. To write code without running it

Solution

  1. Step 1: Understand the pipeline concept

    A data analysis agent pipeline links several data tasks into a sequence.
  2. Step 2: Identify the main goal

    The goal is to automate and organize these steps for easy reuse and flow.
  3. Final Answer:

    To organize multiple data steps into one automated flow -> Option B
  4. Quick Check:

    Pipeline = organized automated flow [OK]
Hint: Pipelines automate step-by-step data tasks [OK]
Common Mistakes:
  • Confusing pipelines with data storage
  • Thinking pipelines create visuals manually
  • Assuming pipelines only write code
2. Which of the following is the correct way to define a step in a data analysis agent pipeline?
easy
A. step = agent.add_step('clean_data', function=clean)
B. step = agent.run('clean_data')
C. step = agent.delete_step('clean_data')
D. step = agent.save('clean_data')

Solution

  1. Step 1: Identify how to add a step

    Adding a step uses add_step with a name and function.
  2. Step 2: Check options for correct syntax

    Only step = agent.add_step('clean_data', function=clean) uses add_step correctly with parameters.
  3. Final Answer:

    step = agent.add_step('clean_data', function=clean) -> Option A
  4. Quick Check:

    Add step uses add_step() method [OK]
Hint: Add steps with add_step(name, function) [OK]
Common Mistakes:
  • Using run() instead of add_step() to define steps
  • Trying to delete or save steps when defining
  • Missing function parameter in add_step
3. Given this pipeline code snippet:
agent = Agent()
agent.add_step('load', function=load_data)
agent.add_step('clean', function=clean_data)
agent.add_step('analyze', function=analyze_data)
result = agent.run()

What will result contain?
medium
A. An error because run needs parameters
B. The output of load_data function
C. A list of all step names
D. The output of analyze_data function

Solution

  1. Step 1: Understand the pipeline run process

    Running the pipeline executes steps in order, passing data along.
  2. Step 2: Identify final output

    The last step's output (analyze_data) is returned as result.
  3. Final Answer:

    The output of analyze_data function -> Option D
  4. Quick Check:

    Pipeline run returns last step output [OK]
Hint: Pipeline run returns last step's result [OK]
Common Mistakes:
  • Thinking run returns first step output
  • Expecting a list of step names as output
  • Assuming run requires extra parameters
4. You wrote this pipeline code:
agent = Agent()
agent.add_step('load', function=load_data)
agent.add_step('clean', function=clean_data)
result = agent.run()

But you get an error: KeyError: 'analyze'. What is the likely cause?
medium
A. The 'load_data' function returns None
B. The 'clean_data' function has a syntax error
C. Missing the 'analyze' step before running
D. The agent.run() method is called with wrong parameters

Solution

  1. Step 1: Analyze the error message

    The error KeyError: 'analyze' means the pipeline expects an 'analyze' step.
  2. Step 2: Check pipeline steps

    The code only adds 'load' and 'clean' steps, missing 'analyze'.
  3. Final Answer:

    Missing the 'analyze' step before running -> Option C
  4. Quick Check:

    KeyError means missing step [OK]
Hint: Check all required steps added before run [OK]
Common Mistakes:
  • Blaming function syntax errors without checking steps
  • Assuming run parameters cause KeyError
  • Ignoring missing step names in pipeline
5. You want to create a pipeline that loads data, filters out rows with missing values, and then calculates the average of a column. Which pipeline step order is correct?
hard
A. load_data -> filter_missing -> calculate_average
B. calculate_average -> load_data -> filter_missing
C. filter_missing -> calculate_average -> load_data
D. calculate_average -> filter_missing -> load_data

Solution

  1. Step 1: Understand logical data flow

    First, data must be loaded before any processing.
  2. Step 2: Order filtering before calculation

    Filtering missing values must happen before calculating averages to avoid errors.
  3. Step 3: Confirm step order

    Correct order is load_data, then filter_missing, then calculate_average.
  4. Final Answer:

    load_data -> filter_missing -> calculate_average -> Option A
  5. Quick Check:

    Load before filter before calculate [OK]
Hint: Load data first, then clean, then analyze [OK]
Common Mistakes:
  • Calculating before loading data
  • Filtering after calculating averages
  • Mixing step order randomly