如何解决如何从pyspark数据框列中删除软连字符或长破折号
无法拆分长破折号的Experience_datesEmployeed列。如何分割字符串或如何从列值中删除长破折号。
我尝试使用UTF-8编码读取文件。
df_final=spark.read.options(header="True",inferSchema='True',delimiter=',').option("encoding","UTF-8").csv("/path/csv")
试图用Unicode拆分,例如8212,8211,2014。
df_final.withColumn('Splitted',split(df_final['Experience_datesEmployeed'],u'\u2014')[0]).show()
示例CSV文件
fullName,Experience_datesEmployeed,Experience_expcompany,Experience_expduraation,Experience_position
David,Feb 1999 – Sep 2001,Foothill,2 yrs 8 mos,Marketing Assoicate
David,1994 – 1997,abc,3 yrs,Senior Auditor
David,Jun 2020 – Present,Fellows INC,3 mos,Director Board
David,2017 – Jun 2019,2 yrs,Fellow - Class 22
David,Sep 2001 – Present,The John D.,19 yrs,Manager
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。