How to Transfer Pandas DataFrame to .csv on SFTP using Paramiko Library in Python?

后端 未结 1 454
一生所求
一生所求 2020-12-06 14:14

I want to transfer a Python dataframe directly as a .csv file to a remote server using Paramiko module. Currently, I save the dataframe as a .csv then I push that .csv file

相关标签:
1条回答
  • 2020-12-06 14:57

    Just use SFTPClient.open

    with sftp.open('path_to_remote_file', "w") as f:
        f.write(df.to_csv(index=False))
    
    0 讨论(0)
提交回复
热议问题