久久久久久久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:“浮動對象不可下標)
主站蜘蛛池模板: 中文字幕av久久爽av | 天天干天天舔 | 精品久久一区二区三区 | 午夜精品一区二区三区在线播放 | 欧美激情亚洲 | 免费的毛片| www.色综合 | 黄色免费片 | 日韩欧美亚洲国产 | 国产综合亚洲精品一区二 | 日日操日日射 | 亚洲精品免费在线 | 国产精品久久久久久久久久 | 天天插夜夜操 | 亚洲毛片av| 免费看大片a | 日韩免费网站 | 天天看天天射 | 国产精品欧美激情 | 欧美日韩高清在线 | 国产精品成人免费视频 | 欧美色图一区二区 | 一级性生活视频 | 国产美女一区 | 欧美成人精品一区二区 | 青草视频网站 | 国产日韩欧美日韩大片 | 他揉捏她两乳不停呻吟动态图 | 成人网在线观看 | a在线免费观看 | 久久精品久久久精品美女 | 欧美xxxx网站 | 一二三四区在线观看 | 欧美午夜视频 | 88av视频 | a在线观看| 狠狠干狠狠干 | 青青国产视频 | 日韩国产在线观看 | 18色av| 五月在线视频 |