使用ANSI编码读取pyspark中的CSV文件 [英] Read CSV file in pyspark with ANSI encoding
本文介绍了使用ANSI编码读取pyspark中的CSV文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试读取一个要求使用ANSI编码读取的csv/文本文件.但是,这是行不通的.有什么想法吗?
I am trying to read in a csv/text file that requires it to be read in using ANSI encoding. However this is not working. Any ideas?
mainDF= spark.read.format("csv")\
.option("encoding","ANSI")\
.option("header","true")\
.option("maxRowsInMemory",1000)\
.option("inferSchema","false")\
.option("delimiter", "¬")\
.load(path)
java.nio.charset.UnsupportedCharsetException:ANSI
java.nio.charset.UnsupportedCharsetException: ANSI
文件超过5GB,因此需要火花.
The file is over 5GB hence the spark requirement.
我也尝试使用小写ANSI
I have also tried ANSI in lower case
推荐答案
ISO-8859-1与ANSI相同,因此请替换上面的
ISO-8859-1 is the same as ANSI so replace that as above
这篇关于使用ANSI编码读取pyspark中的CSV文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文