I am trying to download a file from an FTP server in memory, transform it to a dataframe but also return it as bytes. Code as follows:
import io import panda
read_csv probably closes the "file". So read it before you call read_csv:
read_csv
download_file.seek(0) contents = download_file.read() download_file.seek(0) file_to_process = pd.read_csv(download_file, engine='python')