Valid SPS-C01 Dumps shared by EduDump.com for Helping Passing SPS-C01 Exam! EduDump.com now offer the newest SPS-C01 exam dumps, the EduDump.com SPS-C01 exam questions have been updated and answers have been corrected get the newest EduDump.com SPS-C01 dumps with Test Engine here:
You have a Snowpark DataFrame named 'orders_df with columns 'order_id', 'customer_id', 'order_date', and 'order_total'. You need to perform the following data enrichment steps using Snowpark for Python: 1. Calculate the 'year' from the 'order_date' column. 2. Calculate the 'discounted_total' by applying a discount of 10% if the 'order_total' is greater than $100, otherwise, no discount. 3. Create a new column 'customer_tier' based on the total spend per customer for each year. Customers with total spend greater than $1000 are 'Gold', between $500 and $1000 are 'Silver', and below $500 are 'Bronze'. Which of the following code snippets correctly implements these data enrichment steps using Snowpark (Assume the existence of a customer total spend df DataFrame).
Correct Answer: B
Option B is the most efficient and correct. It calculates 'year' and 'discounted_total' using built-in functions. It then groups by 'customer_id' and 'year' to calculate 'total_spend'. Critically, it then assigns the 'customer_tier' using a series of 'when' statements directly within Snowpark, avoiding the performance overhead of a UDE Finally, it joins the customer tier information back to the original 'orders df. Option A implements Customer Tier calculation using UDF, Option C introduces Windowing without need. Options D, E are incomplete.