Issue
I am New to Data Science, And I am using Spark with PySpark API. I want to Create a DataFrame of a .CSV File. And when i am doing that the Columns are moved to One Single Column as shown below.
The Commnds that i have used to Create a DataFrame of the CSV file are
from pyspark.sql import SparkSession
spark = SparkSession.builder.appName("MyFirstCSVLoad").getOrCreate()
df = spark.read.csv("order.csv")
df.Show()
Can anyone help me how to fix that issue.
The Link to the CSV File https://mega.nz/file/opQFxQbJ#Csjk-CtAkb1CwB6F3hULk3xJxkAOdPyAMMCFjI30MEk
Solution
I look at your data and its seems that your delimiter is ";" and not comma. In that case when you read your CSV file you should specifici the delimiter. Use:
spark.read.option("delimiter", ";").csv(fileName)
Answered By - Tal
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.