【问题标题】:How to upload Cloud files into Python如何将云文件上传到 Python
【发布时间】:2017-07-01 04:19:03
【问题描述】:

我用来将 excel 文件上传到 pandas 数据框 pd.ExcelFile 如果文件在我的本地驱动器中 如果我在 Google Drive 或 Microsoft One Drive 中有一个 Excel 文件并且我想远程连接,我该怎么做?

【问题讨论】:

    标签: excel python-3.x pandas


    【解决方案1】:

    您可以在 StringIO 对象上使用 read_csv():

    from StringIO import StringIO  # moved to io in python3.
    
    import requests
    r = requests.get('Your google drive link')
    data = r.content
    
    df = pd.read_csv(StringIO(data))
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-07-12
    • 2019-05-06
    • 1970-01-01
    • 2020-04-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多