snowflake.snowpark.DataFrame.select_expr¶
- DataFrame.select_expr(*exprs: Union[str, Iterable[str]]) DataFrame [source]¶
Projects a set of SQL expressions and returns a new
DataFrame
. This method is equivalent toselect(sql_expr(...))
withselect()
andfunctions.sql_expr()
.selectExpr()
is an alias ofselect_expr()
.- Parameters:
exprs – The SQL expressions.
Examples:
>>> df = session.create_dataframe([-1, 2, 3], schema=["a"]) # with one pair of [], the dataframe has a single column and 3 rows. >>> df.select_expr("abs(a)", "a + 2", "cast(a as string)").show() -------------------------------------------- |"ABS(A)" |"A + 2" |"CAST(A AS STRING)" | -------------------------------------------- |1 |1 |-1 | |2 |4 |2 | |3 |5 |3 | --------------------------------------------