title: Read CSV/Excel files from SFTP file, make some changes in those files using Pandas, and save back
body: <p>I want to read some CSV/Excel files on a secure SFTP folder, make some changes (fixed changes in each file like remove column 2) in those files, upload them to a Postgre DB and also the upload them to a different SFTP path in Python</p>
  
  <p>What's the best way to this?</p>
  
  <p>I have made a connection to the SFTP using pysftp library and am reading the Excel:</p>
  
  <pre><code>import pysftp
  import pandas as pd
  
  myHostname = "*****"
  myUsername = "****"
  myPassword = "***8"
  cnopts =pysftp.CnOpts()
  cnopts.hostkeys = None  
  
  sftp=pysftp.Connection(host=myHostname, username=myUsername, 
  password=myPassword,cnopts=cnopts)
  print ("Connection succesfully stablished ... ")
  sftp.chdir('test/test')
  #sftp.pwd
  a=[]
  for i in sftp.listdir_attr():
      with sftp.open(i.filename) as f:
          df=pd.read_csv(f)
  </code></pre>
  
  <p>How should I proceed with the upload to DB and making those changes to the CSV permanent?</p>