How to Read CSV files in Google Colab from Drive (from computer) (python pandas)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we are going to talk about how to read a CSV file in Google collab from your drive I mean from your computer and Python program language using the pandas package so please stay tuned so first of all you should go to google.com and remember that you should have logins to your Google account to your email and here you should click on this icon which is Google Apps and then you should go to Google Drive you should click on this in order to go to Google Drive and as you can see here is my Google Drive so I want to create a folder let's say called data set so I click on this new button and I click on new folder and I want to name that folder data set and I press the create button so you can see the folder has been created so I double click on it in order to open that folder and here is my data set which is the iris data set so you can see it is the iris dataset which I want to read this Iris data set in Google collab so I should drag this and I should drop it here in order to start uploading this file so we can see the uploading process has been successful so let's close this and now in Google you should simply type Google collab so you should search for Google collab and here is the link collab.research.google.com you should click on it and again remember that it should have login to your Google account which we have talked in the beginning of this video so now I want to create a new notebook so I click on this so now in order to read that CSV file first let's talk about the easier way the easier way is to click on this files button and then you should click on this which says Mount Drive I mean Mount Your Google Drive so you should click on this and it asks you whether you want to permit this notebook to access your Google drive or not so I want to connect that to my Google Drive so I click on this and it asks me the Google account which I want to use so here is my Google account and now we can see that it is mounting the Google Drive so that's it you can see it has been mounted so I should click on this and again I should click on this and here we can see I have a folder called data set which we have created so I click on it and now we can see here is our CSV file so I right click on it and I should copy the path because we need it for reading our data set so now we should import pandas as PD so we import pandas as PD so let's zoom in a little bit so we import pen as SPD let's run the code and you can see it has been run so now let's insert a code block below this cell and now I want to read that CSV file so the path of that CSV file is this which I have copied so I have pressed Ctrl V in order to paste the path which we have copied here so that's it and now I want to read that CSV file so I simply type PD dot read CSV and I should pass the path variable so that's it and I store that in a variable let's say called DF and now I want to see for example the first of five rows so I simply type DF dot hit and I pass five I mean five rows the first five rows so if I run this code block you can see here's the output which is our Iris data set and now let's talk about the second method in order to do so first of all you should click on runtime and then it should disconnect and delete runtime because you want to restart all the thing so here I should click on yes and you can see it has been restarted and also we want to delete this output so I click on this that's it so as a matter of fact we have restarted all the stuff so now I want to mount our Google drive with a piece of code so let's insert a code block here so I click on this in order to insert a code block so here I should simply type from google.collab I want to import the drive and then I'm going to mount that drive on and I should pass at the path in order to mount our Google Drive so the path is Contents I mean our files and I want to mount that to the Google Drive so that's it and here I should press the Run button so now you can see it asks me in order to permit The Notebook to access my Google Drive so I click on connect to Google Drive and here's the Google account which I want to connect and it says it needs these things to access and I press allow and you can see the mounting process has been successful so now I run this code block and as you can see the path is exactly the same because it is in my drive and also it is in my drive and it is in the data set folder and it is here so again the path is exactly the same and now I click on this in order to run this code block and you can see here is the output now I really suggest you to watch this video which is on the screen now
Info
Channel: Koolac
Views: 79,168
Rating: undefined out of 5
Keywords: google colab python, google colaboratory, python colab, colab python, google colab for python, pandas, How to read csv to dataframe in Google Colab, How to Read CSV files in Google Colab from Drive, Import or Upload Local File to Google Colab, How to read csv file in Google colab using pandas, How to import dataset in Google Colab from Drive, google colab pandas read csv from computer, google colab pandas read csv from drive, python, python programming, python pandas, pandas python
Id: VCllZKM7Njk
Channel Id: undefined
Length: 5min 54sec (354 seconds)
Published: Fri Dec 02 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.