How to unzip a zip file in Jupyter/Google Colab?
The problem is solved after having hours of search over google…
I was solving a Deep Learning assignment using Google Colab. I had a dataset of images contained in a different folder for each image in Google drive and for the label of the dataset, I was having a data frame consisting of path and label.
So, I was supposed to use ImageDataGenerator’s method flow_from_dataframe()
.
That was the reason that instead of mounting Google drive I downloaded the zip into the RAM of Google Colab using the CurlWget extension(very fast downloading). Because flow_from_dataframe() will take a lot of time to get the image from Google drive.
Now, the problem was to unzip the downloaded zip file in the Google Colab.
How I downloaded the file?
Solution:
Let’s unzip the above file
- install patool:
2. import patool:
3. use patoolib.extract_archive()
Note: You can unzip almost every type of zipped file.
Thanks!
Subscribe to my Youtube channel to know more about Data Science.
The Data Science course will be started soon on my channel.
Click here! to subscribe and get a notification when I will start this course from absolute scratch.