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

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

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

問題描述

我想將文件從 FTP 服務器加載到 Pandas 數(shù)據(jù)幀中,而無需先將其下載到磁盤.我寫了一個腳本來執(zhí)行這個命令,但下載到磁盤.這可能在 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模板網(wǎng)!

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

相關文檔推薦

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:“浮動對象不可下標)
主站蜘蛛池模板: 毛片视频网站 | 福利视频网 | 在线中文字幕第一页 | 免费观看黄网站 | 国产精品乱码一区二区三区 | 爱综合| 九九热免费看 | 免费一级毛片 | 国产精品国产精品 | 18gay男同69亚洲网站 | 国产乱码精品一区二区三区忘忧草 | 很黄很污的网站 | 日韩欧美国产精品一区二区三区 | xx视频在线| h片在线免费观看 | 日韩在线免费观看视频 | 在线黄av| 中文字幕不卡视频在线观看 | 久久亚洲综合 | 国产欧美日韩一区二区三区在线 | 麻豆changesxxx国产 | 精品一区二区三区在线播放 | 香蕉久久a毛片 | 精品视频导航 | 精品久久99 | 国产精品视频免费观看 | 欧美亚洲另类在线 | 久久久国产精品入口麻豆 | 国产特级毛片aaaaaa喷潮 | 九一在线| 一级片网站视频 | 人人干人人玩 | 欧美视频三区 | 爱操影视 | 免费网站国产 | 欧美精品区 | 午夜爽爽爽男女免费观看影院 | 午夜成人在线视频 | 亚洲综合无码一区二区 | 天堂在线91 | 欧美极品在线观看 |