Category Archives: Spark – pyspark

Pyspark – getting started – useful stuff

Example to create dataframe from pyspark import SparkConf, SparkContext from pyspark.sql import SparkSession spark = SparkSession.builder.getOrCreate() sc = spark.sparkContext def create_dataframe(): """ Example to create dataframe """ headers = ("id" , "name") data = [ (1, "puneetha") ,(2, "bhoomika") ] df = spark.createDataFrame(data, headers) df.show(1, False) # Output: # |id |name | # +—+——–+ #… Read More »