PySpark – split()

pyspark-mytechmint

PySpark SQL provides split() function to convert delimiter separated String to an Array (StringType to ArrayType) column on DataFrame. This can be done by splitting a string column based …

Read More ➜

PySpark – lit()

pyspark-mytechmint

PySpark SQL functions lit() and typedLit() are used to add a new column to DataFrame by assigning a literal or constant value. Both these functions return Column type as return type. …

Read More ➜

PySpark – expr()

pyspark-mytechmint

PySpark expr() is a SQL function to execute SQL-like expressions and to use an existing DataFrame column value as an expression argument to Pyspark built-in functions. Most …

Read More ➜

PySpark – partitionBy()

pyspark-mytechmint

PySpark partitionBy() is a function of pyspark.sql.DataFrameWriter the class which is used to partition the large dataset (DataFrame) into smaller files based on one or multiple columns while …

Read More ➜

PySpark – fillna() and fill()

pyspark-mytechmint

In PySpark, DataFrame.fillna() or DataFrameNaFunctions.fill() is used to replace NULL/None values on all or selected multiple DataFrame columns with either zero(0), empty string, space, or any constant literal values. While …

Read More ➜

PySpark – sample() and sampleBy()

pyspark-mytechmint

PySpark provides a pyspark.sql.DataFrame.sample(), pyspark.sql.DataFrame.sampleBy(), RDD.sample(), and RDD.takeSample() methods to get the random sampling subset from the large dataset, In this article, I will explain with Python examples. If …

Read More ➜

PySpark – flatMap()

pyspark-mytechmint

PySpark flatMap() is a transformation operation that flattens the RDD/DataFrame (array/map DataFrame columns) after applying the function on every element and returns a new PySpark RDD/DataFrame. In …

Read More ➜