- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2021 12:45 PM
I'm using:
frame = spark.read.csv(path=bucket+folder,
inferSchema = True,
header = True,
multiLine=True
)
to read in a series of CSV files.
For one of my column headers, the parser is picking up a \r in the column name when I dig into the schema. Note "finalLink\r" in the schema listing:
[.......k', 'StringType'), ('finalLink\r', 'StringType'), # this is the \r ('period_p', 'StringType'), ('year_p', 'IntegerType')]What flags should I be using in order to avoid parsing the carriage returns? It could be that there is juust an extra one in one of the CSV files but am not sure what is causing it.
Lee
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2021 04:47 AM
Files saved in Windows operation system contain carriage return and line feed in every line.
Please add following option it can help:
.option("ignoreTrailingWhiteSpace", true)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2021 04:47 AM
Files saved in Windows operation system contain carriage return and line feed in every line.
Please add following option it can help:
.option("ignoreTrailingWhiteSpace", true)

