Aditya Verma
Aditya Verma

Reputation: 31

how to unzip .7z file on google colaboratory?

I am trying to solve grocery dataset from kaggle https://www.kaggle.com/c/favorita-grocery-sales-forecasting/data I am unable to unzip the train.csv.7z file on google colab.

I have tried !p7zip -d train.csv.7z but its giving error /usr/bin/p7zip: cannot read train.csv.7z

Upvotes: 1

Views: 3647

Answers (1)

Chandan M S
Chandan M S

Reputation: 411

In order to access data, you must first upload the csv.7z file on a drive and give Colab permission to access it. This can be done by,

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

After that, you can access the data in drive.

Example :

If the train.csv.7z is inside a folder called 'train' in Drive, you can access it by running the following

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

After giving access, run the command,

!p7zip -d './gdrive/My Drive/train/train.csv.7z'

Let me know if this works.

Upvotes: 2

Related Questions