简体   繁体   中英

How to import Your own data to google colab

I'm kinda new in python and tensorflow. I want to run my Deep network on a collab for human activity recognition. The problem is I don't know how to import my dataset to collab! I already did upload dataset to Drive. (The dataset link is in below) http://www.cis.fordham.edu/wisdm/dataset.php and I want to just use the WISDM_ar_v1.1_raw.txt file

You got to mount your google drive in your notebook

from google.colab import drive
drive.mount('/content/drive')

Reference

column_names = ['user-id','activity','timestamp', 'x-axis', 'y-axis', 'z-axis'] data = pd.read_csv(('My Drive/app/WISDM_ar_latest.tar.gz/WISDM_ar_v1.1/WISDM_ar_v1.1_raw.txt',header = None, names = column_names)

  File "<ipython-input-26-033bf3a3f419>", line 2
    data = pd.read_csv(('My Drive/app/WISDM_ar_latest.tar.gz/WISDM_ar_v1.1/WISDM_ar_v1.1_raw.txt',header = None, names = column_names)
                                                                                                         ^
SyntaxError: invalid syntax

According to your post you have one redundant bracket that leads to syntax error. Try this

data = pd.read_csv(filepath_or_buffer = 'My Drive/app/WISDM_ar_latest.tar.gz/WISDM_ar_v1.1/WISDM_ar_v1.1_raw.txt',header = None, names = column_names)

Okey It's solved now! All think you need to do is just upload or data to your drive. (I uploaded in folder name: "app") Then

from google.colab import drive
drive.mount('/content/drive/')

Now by this code you can import the data (Edit: Moved drive.mount to next line):

data = pd.read_csv("/content/drive/My Drive/app/WISDM_ar_v1.1_raw.txt")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM