How to import data into google colab from google drive?

前端 未结 2 1459
既然无缘
既然无缘 2021-01-02 02:52

I have some data files uploaded on my google drive. I want to import those files into google colab.

The REST API method and PyDrive method show how to create a new f

2条回答
  •  醉话见心
    2021-01-02 03:20

    !) Set your data to be publicly available then for public spreadsheets:

    from StringIO import StringIO  # got moved to io in python3.
    
    import requests
    r = requests.get('https://docs.google.com/spreadsheet/ccc? 
    key=0Ak1ecr7i0wotdGJmTURJRnZLYlV3M2daNTRubTdwTXc&output=csv')
    data = r.content
    
    In [10]: df = pd.read_csv(StringIO(data), index_col=0,parse_dates= 
    ['Quradate'])
    
    In [11]: df.head()
    

    More here: Getting Google Spreadsheet CSV into A Pandas Dataframe

    If private data sort of the same but you will have to do some auth gymnastics...

提交回复
热议问题