From the course: Snowpark for Data Engineers

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Data transformations using Snowpark DataFrames

Data transformations using Snowpark DataFrames - Snowflake Tutorial

From the course: Snowpark for Data Engineers

Data transformations using Snowpark DataFrames

- [Instructor] Every dataframe returned by the session.table command has a schema property that you can use to access the schema of that dataframe. Here I call .schema on the dataframe returned by session.table and I print out the table schema. The table schema is of a struct type. You can see struct fields to represent the different fields and the types of the different fields as well. Let's look at some data manipulation that you can do with SnowparkDataFrames. Rather than selecting all of the columns in our table and storing that in a dataframe, let's say you want just a few selected columns. You can call the .select method on a dataframe and pass in column objects that you're interested in. Name, serving size, and calories. The resulting dataframe has only the columns that we had specified in our select method. Next, let's see how we can perform a simple filter operation. Session.table returns a dataframe. I invoke the .filter method on a dataframe and I specify that I want the…

Contents