QuestionQ24

VerifiedPrepare data and use feature engineering in Snowflake

Which statement will add a column according to the following condition?

A Data Scientist wants to change Product 1 to P1, Product 1A to P1A, and Product 1B to P1B. If none of these conditions are met, the record should be Not P1.

Explanation

Snowpark Python's DataFrame.with_column returns a DataFrame with an additional named column, and chained when expressions followed by otherwise implement conditional mappings with a default value. Using == creates the required column comparisons, so this produces PID with the requested values and Not P1 for all other records.

Learn more

Community Discussion

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