Complete the code to create a Snowpark session.
from snowflake.snowpark import Session connection_parameters = { "account": "[1]", "user": "user_name", "password": "password", "role": "SYSADMIN", "warehouse": "COMPUTE_WH", "database": "MY_DB", "schema": "PUBLIC" } session = Session.builder.configs(connection_parameters).create()
The account parameter specifies your Snowflake account identifier, which is required to establish a session.
Complete the code to create a DataFrame from a Snowflake table.
df = session.table("[1]")
The table method requires the table name to create a DataFrame representing that table.
Fix the error in the code to apply a filter on the DataFrame.
filtered_df = df.filter(df["AGE"] [1] 30)
The correct operator to filter rows where AGE is greater than 30 is >.
Fill both blanks to select columns and show the first 5 rows.
result = df.select([1]).limit([2]).collect()
Selecting columns "NAME" and "AGE" and limiting to 5 rows shows a small sample of the data.
Fill all three blanks to create a new column with a calculation and filter rows.
from snowflake.snowpark.functions import col new_df = df.withColumn("AGE_PLUS_SALARY", col("AGE") [1] col("SALARY")).filter(col("AGE_PLUS_SALARY") [2] [3])
The code adds AGE and SALARY columns, then filters rows where the sum is greater than 1000.