Pig is an Apache project that uses a scripting language to query and analyze large data sets. With Apache Pig, users can create MapReduce programs without writing Java code. This e-learning module teaches you how to write user-defined functions (UDFs) that can be executed inside of Pig to extend performance and develop a custom library of operations. We discuss what Pig UDFs are, supported functions and languages, and how to write custom UDFs in Java and Python. The module includes a hands-on exercise where you will write your own UDF in Python, complete with a sample solution.