Complete the code to create a Snowpark DataFrame from a table named 'employees'.
df = session.table([1])The session.table() method requires the table name as a string. Using double or single quotes is the standard way to specify the table name.
Complete the code to select the 'name' and 'salary' columns from the DataFrame.
df_selected = df.select([1])The select method takes column names as strings separated by commas. Both column names must be in quotes.
Fix the error in the code to filter rows where salary is greater than 50000.
df_filtered = df.filter(df[[1]] > 50000)
When accessing columns by name in a DataFrame, use the column name as a string inside square brackets.
Fill both blanks to create a new column 'bonus' which is 10% of 'salary' and select it along with 'name'.
df_new = df.select([1], (df[[2]] * 0.1).alias("bonus"))
Column names must be strings inside quotes when used with df[]. The select method takes column names as strings.
Fill all three blanks to group by 'department', calculate average 'salary' as 'avg_salary', and filter departments with avg_salary > 60000.
df_grouped = df.groupBy([1]).agg(df[[2]].avg().alias([3])).filter("avg_salary > 60000")
Use quoted column names for grouping and aggregation. The alias name must also be a string.