The correct answer is to modify the preprocessing script to cast 'age' to float using astype(float). This resolves the failure because SageMaker Processing jobs require consistent data types within a column for distributed processing; when the 'age' column contains mixed types—such as strings and integers—the job’s underlying framework cannot serialize or deserialize the data uniformly, causing a type mismatch error. On the AWS Certified Machine Learning Engineer Associate MLA-C01 exam, this scenario tests your understanding of data preparation pitfalls in SageMaker, where raw data often arrives with inconsistent types due to missing values or mixed formats. A common trap is assuming SageMaker will automatically infer or coerce types, but it does not—explicit casting in your preprocessing script is mandatory. Memory tip: think “cast before you blast” to remember that explicit type conversion in your script prevents processing failures.
MLA-C01 Data Preparation for Machine Learning Practice Question
This MLA-C01 practice question tests your understanding of data preparation for machine learning. The scenario asks you to isolate a root cause — eliminate options that address a different problem before choosing. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
Exhibit
ProcessingJobError: Execution failed
Error: Traceback (most recent call last):
File "/opt/ml/processing/input/code/preprocess.py", line 45, in <module>
df['age'] = df['age'].apply(float)
ValueError: could not convert string to float: 'twenty-five'
Refer to the exhibit. A SageMaker Processing job fails with the following error log. Which change during data preparation would resolve the issue?
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Modify the preprocessing script to cast 'age' to float using astype(float)
Option D is correct because the error log indicates a type mismatch when processing the 'age' column, likely due to mixed data types (e.g., strings and numbers) in a column expected to be numeric. By explicitly casting the column to float using astype(float) in the preprocessing script, you ensure consistent numeric type handling, which resolves the failure during SageMaker Processing job execution.
Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
✗
In SageMaker Data Wrangler, set the 'age' column type to 'number'
Why it's wrong here
Data Wrangler’s type setting does not affect the actual data types parsed in the processing script.
✗
Drop rows with missing values in the 'age' column before training
Why it's wrong here
Dropping rows does not fix the type error; the column still contains strings.
✗
Remove the 'age' column from the dataset entirely
Why it's wrong here
This discards a potentially important feature.
✓
Modify the preprocessing script to cast 'age' to float using astype(float)
Why this is correct
Casting the column ensures numeric operations work.
Related concept
Read the scenario before looking for a memorised answer.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is that candidates often assume missing value handling (Option B) or column removal (Option C) is the fix, when the actual issue is a data type inconsistency that requires explicit type casting in the preprocessing code.
Detailed technical explanation
How to think about this question
Under the hood, SageMaker Processing jobs use Pandas or PySpark to read data, and if a column contains mixed types (e.g., integers and strings), Pandas may infer the column as object dtype, causing failures when downstream operations expect numeric types. The astype(float) method explicitly coerces all values to float, raising errors for non-convertible entries, which can be caught and handled (e.g., with pd.to_numeric and errors='coerce'). In real-world scenarios, this is common when CSV files contain entries like 'age: 25' or '25 years', requiring robust parsing before training.
KKey Concepts to Remember
Read the scenario before looking for a memorised answer.
Find the constraint that changes the correct option.
Eliminate answers that are true in general but not in this case.
TExam Day Tips
→Watch for words such as best, first, most likely and least administrative effort.
→Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.
Real-world example
How this comes up in practice
A cloud solutions architect for a retail company is evaluating services for a new workload. The correct answer here reflects best practice for the specific scenario described — not a general cloud recommendation. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Cloud exam questions reward reading the constraint carefully: the same technology can be right or wrong depending on the use case.
What to study next
Got this wrong? Here's your next step.
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
Data Preparation for Machine Learning — This question tests Data Preparation for Machine Learning — Read the scenario before looking for a memorised answer..
What is the correct answer to this question?
The correct answer is: Modify the preprocessing script to cast 'age' to float using astype(float) — Option D is correct because the error log indicates a type mismatch when processing the 'age' column, likely due to mixed data types (e.g., strings and numbers) in a column expected to be numeric. By explicitly casting the column to float using astype(float) in the preprocessing script, you ensure consistent numeric type handling, which resolves the failure during SageMaker Processing job execution.
What should I do if I get this MLA-C01 question wrong?
Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.
What is the key concept behind this question?
Read the scenario before looking for a memorised answer.
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
This MLA-C01 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the MLA-C01 exam.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.