Load local data files to Colaboratory

后端 未结 9 736
野趣味
野趣味 2020-12-02 08:47

I just wondering that is it possible to load local data files(like .xlsx or .csv files that on my google drive) into Colaboratory?

9条回答
  •  情歌与酒
    2020-12-02 09:07

    To get data from your system to colab try this:

    from google.colab import files
    uploaded = files.upload()
    

    Choose the file you want to upload and hit enter and its done. For example, I have uploaded an image and displayed it using the code below:

    import cv2
    import numpy as np
    from matplotlib import pyplot as plt
    
    img = cv2.imread('image.jpg')
    img_cvt = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
    
    plt.imshow(img_cvt)
    plt.show()
    

提交回复
热议问题