concept Python in category pyspark

This is an excerpt from Manning's book Data Analysis with Python and PySpark.
PySpark provides an entry point to Python in the computational model of Spark. Spark itself is coded in Scala, a language very powerful if a little hard to grasp. In order to meet users where they are, Spark also provides an API in Java, Python and R. The authors did a great job at providing a coherent interface between language while preserving the idiosyncrasies of the language where appropriate. Your PySpark program will therefore by quite easy to read by a Scala/Spark programmer, but also to a fellow Python programmer who hasn’t jumped into the deep end (yet).
Python is a dynamic, general purpose language, available on many platforms and for a variety of tasks. Its versatility and expressiveness makes it an especially good fit for PySpark. The language is one of the most popular for a variety of domains, and currently is a major force in data analysis and science. The syntax is easy to learn and read, and the amount of library available means that you’ll often find one (or more!) who’s just the right fit for your problem.
This section covers creating a Python function that will work seamlessly with a PySpark data frame. While Python and Spark are like PB & J, creating and using UDF requires a few precautions. I introduce how you can use Python type hints to make sure your code will work seamlessly with PySpark types. At the end of this section, we will have a function to reduce a fraction and one to transform a fraction into a floating-point number.