from pyspark.sql import SparkSession spark = SparkSession .builder .appName("how to read csv file") .getOrCreate() spark.version !ls data/sample_data.csv df = spark.read.csv('data/sample_data.csv') type(df) df.show(5)