

Defines a custom function called " GetSentiment" which uses a single line of code from NLTK library to get a Sentiment score for any given input value.Downloads Product Reviews into a dataframe called " pd" that resides on the Python machine itself.For example: we got a dataframe (table) of product reviews as in: What if this is DataScience work and is doing something that SQL can never do? Like Sentiment analysis. SQL can easily replicate those things and do it much faster. This was all great for manipulating dataframes like filtering, grouping, sorting, calculating, concatenating, cleaning, trimming &, etc.Joe can run his code using dataframes with billions of rows in minutes using Snowflake compute as the calculation & execution engine.

Snowpark automatically translates the Python dataframe code to regular SQL statements & sends them Snowflake and Snowflake does all the compute-intensive work instead of Joe's old laptop. English translation: Joe has a crappy laptop, Joe writes 100% native Python code using Snowpark libraries & dataframes. During code execution, it seamlessly translates the Python code that is accessing & manipulating dataframes(virtual in-memory codebase tables) into ANSI SQL statements and executes them on Snowflake compute clusters at blazing speeds w/o the need for any compute power on the user's machine.So how does the Snowpark Python Library help? It helps by doing two very important things. These things are impossible to do using SQL and require a programming language like Python & its many 3rd party libraries. (Is this review positive or negative?), processing & extracting data from images, audio & video files or run machine learning models against a ton of data. Often Python & dataframes is a must for data science workloads because Python can do many things that are simply impossible to do using SQL.Askin them to use powerful SQL warehouse compute resources would require them to use SQL (duuuh) which they will politely refuse as it is a major pain in the neck to debug a complex SQL. It can also be easily debugged in case something doesn't work. People using Python and dataframes(in-memory tables) for regular columnar data manipulation & enrichment(as in ELT/ETL) prefer to stick with Python & dataframes for their work because it is much easier to do complex stuff for programmers.It either can't handle the amount of data or is slow to process it because all the hard work is being done on those machine(s). Limited resources on the machine or the cluster that is running the Python code.In the world of Python-based data engineering and data science workloads, most users experience a few common issues when it comes to dealing with production size large datasets. As of last week, Snowflake started its Private Preview of Snowpark Python library to solve this exact problem. Prior to last week, your answer might have been " Ohhh I dunno.either change the requirements or say it can't be done" What do you do if you have an old & slow notebook, a 160 million row dataset containing customer reviews that you have to perform sentiment analysis, and have less than 10 mins to do it with no active nodes/servers to utilize?
