QuestionQ78

Prepare and process data

You have an Azure Databricks workspace that is enabled for Unity Catalog and includes a Delta table named Orders.

You load the Orders table into an Apache Spark DataFrame named df.

You need to create a DataFrame that omits rows where the order amount is null.

Solution: Run the following expression:

df.filter(df.order_amount.isNotNull())  

Does this accomplish the goal?

  • A Yes
  • B No
Explanation

Column.isNotNull() evaluates to true for non-null values, and DataFrame.filter retains rows for which its condition is true. Filtering on order_amount.isNotNull() therefore excludes rows with a null order_amount.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!