exam questions

Exam DP-600 All Questions

View all questions & answers for the DP-600 exam

Exam DP-600 topic 1 question 71 discussion

Actual exam question from Microsoft's DP-600
Question #: 71
Topic #: 1
[All DP-600 Questions]

DRAG DROP
-

You are building a solution by using a Fabric notebook.

You have a Spark DataFrame assigned to a variable named df. The DataFrame returns four columns.

You need to change the data type of a string column named Age to integer. The solution must return a DataFrame that includes all the columns.

How should you complete the code? To answer, drag the appropriate values to the correct targets. Each value may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.

NOTE: Each correct selection is worth one point.

Show Suggested Answer Hide Answer
Suggested Answer:

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
neoverma
Highly Voted 6 months, 4 weeks ago
from pyspark.sql.types import IntegerType from pyspark.sql import functions as F # first method df = df.withColumn("Age", df.age.cast("int")) # second method df = df.withColumn("Age", df.age.cast(IntegerType())) # third method df = df.withColumn("Age", F.col("Age").cast(IntegerType())) https://aporia.com/resources/how-to/change-column-data-types-in-dataframe/ considering the 3rd method for the answer
upvoted 13 times
...
vernillen
Highly Voted 4 months, 4 weeks ago
Correct withColumn | col | cast It's the very basic syntax of data type allocation
upvoted 5 times
...
byyleoo
Most Recent 5 months ago
withColumn > column> cast
upvoted 1 times
...
stilferx
5 months, 3 weeks ago
IMHO, withColumn -> col -> cast is good!
upvoted 3 times
...
Nefirs
6 months, 2 weeks ago
correct - withColumn, col, cast
upvoted 4 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago