What is UDF ?

A User Defined Function is a custom function defined to perform transformation operations on Pyspark dataframes. Once defined it can be re-used with multiple dataframes. It can also be used as an alternative of for-loops for faster performance.

Why is UDF Needed?

UDF can be used to perform data transformation operations which are not already present in Pyspark built-in functionality. For instance, we have a column with string values and we need to create a new column with string values reversed. There is no built-in function to perform this operation and we need to write a custom function.
UDF can be used as an alternate…

Amit Soni

Business Analytics and Data Science Enthusiast

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store