久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

在 Python 中從 FTP 服務器讀取文件到 DataFrame

Reading files from FTP server to DataFrame in Python(在 Python 中從 FTP 服務器讀取文件到 DataFrame)
本文介紹了在 Python 中從 FTP 服務器讀取文件到 DataFrame的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我想將文件從 FTP 服務器加載到 Pandas 數據幀中,而無需先將其下載到磁盤.我寫了一個腳本來執行這個命令,但下載到磁盤.這可能在 ftplib 庫中嗎?你覺得這個問題有什么解決辦法嗎?

I would like to load a file from an FTP server into Pandas dataframe without downloading it to disk first. I have written a script that executes this command but with downloading to disk. Is this possible in the ftplib library? Do you see any solution to this problem?

from ftplib import FTP
import os
import pandas as pd
ftps = FTP('gssc.esa.int')
ftps.login()
ftps.cwd('/gnss/data/daily/2019/001/')
filename = '19001.V3status'
local_filename = os.path.join(r"C:/path/where/download/files", filename) #example
lf = open(local_filename, "wb")
ftps.retrbinary('RETR ' + filename, lf.write)
file = "C:/path/where/download/files/" +filename #example
dataV3status = pd.read_fwf(file,
                           names = ('Mon_ID', 'Full_Mon_ID', 'RNX_Ver.', 'Dly(H)',
                                    'Dly(M)', 'V', 'Receiver_Type', 'Antenna_Type',
                                    'Mkr_Name', 'Marker_Number', 'Typ', 'G', 'R',
                                    'E', 'C', 'J', 'S', 'I', 'MD5_Checksum'), 
                           widths = [5,9,5,5,6,2,20,22,5,10,3,3,2,2,2,2,2,2,32],
                           header = None,
                           skiprows = 5,
                           skipfooter = 16)

推薦答案

如果你想堅持使用 ftplib,你可以這樣做:

If you want to stick with ftplib, you can do something like this:

from io import BytesIO

flo = BytesIO()
ftp.retrbinary('RETR ' + filename, flo.write)
flo.seek(0)
pd.read_fwf(flo, ...)

這篇關于在 Python 中從 FTP 服務器讀取文件到 DataFrame的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Why I cannot make an insert to Python list?(為什么我不能插入 Python 列表?)
Insert a column at the beginning (leftmost end) of a DataFrame(在 DataFrame 的開頭(最左端)插入一列)
Python psycopg2 not inserting into postgresql table(Python psycopg2 沒有插入到 postgresql 表中)
list extend() to index, inserting list elements not only to the end(list extend() 索引,不僅將列表元素插入到末尾)
How to add element in Python to the end of list using list.insert?(如何使用 list.insert 將 Python 中的元素添加到列表末尾?)
TypeError: #39;float#39; object is not subscriptable(TypeError:“浮動對象不可下標)
主站蜘蛛池模板: 天天天插 | 日韩专区中文字幕 | 日韩亚洲一区二区 | 在线午夜| 台湾a级理论片在线观看 | 亚洲一区在线日韩在线深爱 | 欧美一级片在线观看 | 日韩欧美视频 | 成av在线 | 女女爱爱视频 | 日韩中文一区二区三区 | 久久亚洲免费 | 国产精久久久久久久 | 久久久精品国产 | 国产在线对白 | 欧美jizzhd精品欧美巨大免费 | 欧美韩一区二区 | 欧美午夜视频 | 99视频在线免费观看 | 四虎国产 | 中文字幕亚洲视频 | 国产精品美女www爽爽爽 | 偷偷操视频 | 天堂av中文在线 | 狠狠干五月天 | 日韩免费网站 | www视频在线观看 | 久草网免费 | 国产精品1区 | 久久久久国产 | 国产日韩一区二区三区 | 艹逼网| 欧美视频一区 | 国产精品中文字幕在线 | 精品九九 | 欧美一区二区三区高清视频 | 久在线| 成人国产精品色哟哟 | 免费在线成人网 | 在线观看国产精品视频 | 欧美精品福利视频 |