nerdexam
Microsoft

DP-700 · Question #100

You have a table in a Fabric lakehouse that contains the following data: | SalesOrderNumber | OrderDate | CustomerName | Email |…

Statement 1: Line 01 will replace all the null and empty values in the CustomerName column with the Unknown value. Answer: Yes. Statement 2: Line 02 will extract the value before the @ character and generate a new column named Username. Answer: Yes. Statement 3: Line 03 will…

Design and implement data ingestion and transformation

Question

You have a table in a Fabric lakehouse that contains the following data:
SalesOrderNumberOrderDateCustomerNameEmail
SO491722021-01-01Brian Howard[email protected]
SO491732021-01-01Linda Alvarez[email protected]
SO491742021-01-01Gina Hernandez[email protected]
SO491782021-01-01Beth Ruiz[email protected]
SO491792021-01-01Evan Ward[email protected]
You have a notebook that contains the following code segment:
01 df = df.withColumn('CustomerName', when(col('CustomerName').isNull() | (col('CustomerName')==''), lit('Unknown')).otherwise(col('CustomerName')))
02 df = df.withColumn('Username', split(col('Email'), '@').getItem(0))
03 df = df.dropDuplicates(['OrderDate']).selectExpr('*', "year(OrderDate') as Year", "('CustomerName') as Username")
04 display(df.head(10))
For each of the following statements, select Yes if the statement is true. Otherwise, select No. NOTE: Each correct selection is worth one point. Statements:
  1. Line 01 will replace all the null and empty values in the CustomerName column with the Unknown value.
  2. Line 02 will extract the value before the @ character and generate a new column named Username.
  3. Line 03 will extract the year value from the OrderDate column and keep only the first occurrence for each year.

Exhibit

DP-700 question #100 exhibit

Explanation

Statement 1: Line 01 will replace all the null and empty values in the CustomerName column with the Unknown value. Answer: Yes. Statement 2: Line 02 will extract the value before the @ character and generate a new column named Username. Answer: Yes. Statement 3: Line 03 will extract the year value from the OrderDate column and keep only the first occurrence for each year. Answer: No.

Topics

#PySpark#DataFrame Operations#Data Cleaning#Data Transformation

Community Discussion

No community discussion yet for this question.

Full DP-700 Practice