'SparkSession Object has no attribute read_csv
Getting an error message while running the below commands using pyspark (Pycharm IDE)
spark=SparkSession.builder.master("local").appname("Sample").getOrCreate() df=spark.read_csv('filename.csv')
Error: SparkSession object has no attribute read_csv
Solution 1:[1]
Your syntax is incorrect. Use spark.read.csv(...)
Solution 2:[2]
spark needs to use spark.read.csv(file_name)
read_csv(file_name) is pandas function to read CSV files.
Don't get confused with pandas df and spark df.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jarrod Baker |
| Solution 2 | Peter Csala |
