Python- pull csv from ftp url with credentials -


newb python , working apis. source create ftp url dumping files on daily basis , grab file perform engineering + analysis. problem is, how specify username , password pull csv?

import pandas pd data = pd.read_csv('http://site-ftp.site.com/test/cat/filename.csv) 

how include credentials this? ps- url fake sake of example.

you use requests.get() download csv data memory. use stringio make data "file like" pd.read_csv() can read in. approach avoids having first write data file.

import requests import pandas pd io import stringio  csv = requests.get("http://site-ftp.site.com/test/cat/filename.csv") data = pd.read_csv(stringio(csv.text))  print(data) 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -