How to Import (use) Kaggle datasets in Google Colab?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello all welcome back in this session we are going to understand how do we import the kaggle data set into the collab it's a set of procedures that you need to follow but it is easy and it can be understood with ease and i'm going to explain you step by step on the process the first step that you need to understand is to visit to the kaggle website kaggle.com the moment you go in there for example let me start from the beginning i am closing it and i am going into the website so the moment you go and if you already have an account you will get this page and if you do not have an account you can register and it's a half a minute process not more than that so kaggle has got a rich set of data sets with it which you can use for machine learning and deep learning stuff and it's very useful data set for all the data aspirants now what do we do we need to first sign in and that's what i have done right now then we need to go to our profile so here there is an icon you can see that just click it this is the profile and in that you have something called as account just click that account and the moment you click it you'll be taken to the account section of the login now you can scroll down where you will get all the account details and the most important point is we have to generate an apa token which will be used from the collab for you to access the kaggle data set i repeat we have an ap token to be generated from the kaggle for us to access kaggle from collab so how do i do it i have an option here called as apa token so create new api token when i click it will be generated and you will get this message the ensure kaggle dot json is in the location kaggle slash kaggle.json to use the ap i'll tell you how to use it we will go to that step little later but it has to be downloaded and you will find it in your download section this is available here let's go to the download section to see if it is available there it's there so can we open it and see what exactly is there it will have a username and it will have a key which is nothing but the password so this is generator now and the first step is done we are done with the first step now what is the next step to go we have generator an ap token which will have the username and the password now where do we go we need to go to our google account you please login into your google account i have done that i've got one of the google accounts and i have logged in now what do we do you need to go to the drive you need to go to google drive i am getting into it right away so this is the first step that you need to do remember this is second half of the process where you are going to now do something very interesting now if you do a right click here as i am doing you can go to more and if you see that here there is something called as google collaboratory so you are going to create a google a google colab file here and that's going to be created right now you can see that here i have right clicked it and i have opened it that's all so it may take half a minute for you to get it done and you have got the collab file opened and i am going to rename the file as kaggle trial something you can you can name it the way you want so it's not a big deal so kaggle trial dot ipny ipn ipynb so we have created a kaggle trial file now what do we do we need to go ahead with step-by-step process through which we are going to get the kaggle data set live into this google color so i got the commands ready for you i am going to paste this also in the description section so that you can easily follow it so what is the first step the first step is to go ahead and install the kaggle how do we do that we have got install kaggle option with pip install and i am going to do that right now so lets go ahead and run this code now once it is done you can see that it is running it may take some time based on the connectivity and stuff so you may have to wait and you can see that it's still connecting so you may have to wait so once it is initialized once it is run you will get the process up and running so it may take some time at least for the first time so now it is all done you can see that it's getting executed and this is done the first step is over i have installed kaggle with pip install hyphen q now what is the next step to do we need to upload the kaggle.json file i have got a json file which has got my username and password right i need to open it and i need to upload it what is the command for that sir yes we have a command available for that so from google.colab import files have to be used and file start upload option has to be enabled now how do i do it i am doing it here you can see that so the moment i do it i will get an option where i can upload the downloaded kaggle.json file the moment it is done it will go ahead of the process and you will get a message as 100 done the moment you get 100 done message you can understand that that is over so let's issue the next set of commands which are connected to the process now what are we going to do i am going to create a kaggle directory if you already have a directory it will show a message saying that you already have a directory so cannot recreate it if you do not have it it will get it created and that's what is happening here i have created a kaggle directory well what is the next step we are going to go with more interesting steps and it is easy to do also now what are we going to do we are going to copy the json folder i mean json file kaggle.json file into the folder that we have created so we are going to copy the kaggle.json file to the folder that we have created that's what i am doing right now and you could see that it is also done successfully now what is the next step to do we need to grant appropriate permissions there are permissions that are connected to each and every file and as you know we need to use chmod command to change the permissions of the json file whichever we have been using so let me issue that and you can see that the permissions are also changed right now it's a step-by-step process please do not miss anything right we will now understand what are all the available data sets we need to list the data sets which are available in the kaggle and for us to get that information we are going to use the command gaggle data sets list this will immediately list all the available data sets with kaggle and this is going to be very helpful for you to understand which is the one that you are looking for remember this will help you in understanding the data sets that you are looking for now what are the next step that we need to do now we are going to get the google collab with any of the data sets from the kaggle so i have got a lot of data sets in kaggle so i am going to take up one of the data sets which is called as dogs versus cats data set in the kaggle so let's go to kaggle again so you can see that here there is dogs vs cat data set available there there is another dog versus cat data set available there we can choose any of this this is dog versus cat redux kernels edition so this has got 1314 teams four years ago this has been updated you can go through all the details of it if you want and this provides you the complete detail about the data set now what are we going to do we are going to use this data set in the google caller we are going to access this from the google caller so how do we do it very simple see that carefully we are going to click on the data part of it i am going to click on the data part of it and i have clicked it and there you can see that there is a command that is available and this is the one that we need to use towards including this particular data set into your collab so i am going to run it right now and once it is done you can see the message as downloading happens the test and the training data set is all getting downloaded and it will all happen in few seconds so it is 100 done here and we have got all the data sets downloaded i mean the testing and the training data set downloader now where do we go we are in the google collab itself now we need to understand if we have got these things downloaded appropriately i mean if you have got the data set imported appropriately now click this button this is called the table of contents button and in that we have got multiple options here you can see that we've got files options available there the moment you click it you can see that we've got test dot zip and train dots so whatever you have got here in terms of you importing it is all available here this is how you can verify and validate if you have gotten the files appropriately available in the column now what is the next step to do sir very simple we need to go ahead and extract this zip files that's the most important step right we need to extract i mean unzip the zip files how do we do it very simple the commands are also very easy to use and all these commands are available online and i have summarized it for your easier usage so what do we do first we are going to unzip the training dot zip file so how do we do it it's very easy to do and i have done that right now so it will inflate that particular zip and once it is done you can see the number of files which are getting pulled out i mean unzipped out of this training data set now what do we do we need to do the same for testing isn't it we need to do that and we are unzipping that training and the testing data set one after another so now it is done with that test now it goes on for about one minute for you to completely get everything out there and it's pretty easy for you to understand that that's it you have unzipped the data set which are available from the kaggle and you have accessed it through the cola now how am i very sure that these are the files that are required i mean these are the contents that are required for we are these are the contents that are available in kaggle just go here see the name of the file test.sip and train dot zip now come here you can see that test dot zip and train dots that's it you've got the work done you have already imported the files from i mean the data set from the kaggle into your cola and you can start using it i hope you understood the process very clearly and it was easy for you to understand it completely and if you have any questions please come back to me through the comment section i'll be happy to answer you thank you very much and if you like the channel in the content please give a thumbs up and subscribe thank you
Info
Channel: Shriram Vasudevan
Views: 127,766
Rating: undefined out of 5
Keywords: Google Colab, Kaggle, Kaggle Datasets, How to import Kaggle datasets into Google Colab, colab and kaggle datasets
Id: 57N1g8k2Hwc
Channel Id: undefined
Length: 10min 43sec (643 seconds)
Published: Sat Jan 23 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.