我正在使用pandasto_csv()
函数在Zeppelin (MacOS 10.14.6, Google Chrome, pyspark, Python 3.6.8)中打印csv,当我将结果复制并粘贴到另一个应用程序(例如Excel, Google Sheets, Apple Notes)时,它都出现在一行上。我尝试过使用to_csv(line_terminator='rn')
(例如)更新换行符,但我也没有尝试过。
-b
运行VIM并使用:set list
-我在每行末尾看到的都是$
。
我做错了什么?
try this
with open(file_path, mode='w', newline='rn') as f:
data_frame.to_csv(f, index=False)