Question 76

You are working with a Snowpark DataFrame representing sensor data. The DataFrame contains columns like 'timestamp', 'sensor id' , and 'value'. You need to perform a complex windowing operation to calculate the moving average of the 'value' for each 'sensor id' over a 5-minute window, but only for data points where the 'value' is greater than a threshold. The window should be defined based on the 'timestamp' column. What is the most efficient and correct approach to implement this using Snowpark DataFrames?
  • Question 77

    You have a Snowpark DataFrame named 'employee_df with columns 'employee_id', 'department', and 'salary'. You want to calculate the average salary for each department and add it as a new column named 'avg_department_salary' to the original DataFrame. Additionally, you want to sort the resulting DataFrame by department and then by salary in descending order. Which of the following Snowpark code snippets correctly implements this requirement?
  • Question 78

    Consider two Snowpark DataFrames, 'employees' and 'departments' , with the following schemas: 'employees': (employee_id: Integer Type, employee_name: StringType, department_id: Integer Type, salary: IntegerType) 'departments': (department_id: Integer Type, department_name: StringType, location: StringType) You want to find the highest salary within each department, along with the department name and location, and display the results in a Snowpark DataFrame. Which of the following Snowpark Python code snippets correctly achieves this?
  • Question 79

    You are developing a Snowpark application that uses a UDF written in Python. This UDF requires several third-party Python packages (e.g., 'pandas', 'scikit-learn'). You need to ensure these packages are available in the UDF's execution environment within Snowflake. You have the packages listed in a 'requirements.txt' file. Which of the following methods, alone or in combination, correctly provision these dependencies for the UDF? (Select all that apply)
  • Question 80

    You have a Snowpark DataFrame containing customer transaction data'. Your goal is to save this DataFrame as a set of Parquet files in an existing Snowflake stage named , partitioned by the 'transaction_date' column. You want to ensure that the files are automatically compressed using the Zstandard codec and that existing files with the same name are overwritten. Which of the following Snowpark code snippet achieves this with the most optimal approach and respects best practices?