<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by MRINALI GUPTA on Medium]]></title>
        <description><![CDATA[Stories by MRINALI GUPTA on Medium]]></description>
        <link>https://medium.com/@mringupt?source=rss-a30a62d08d0c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*UWCf057qYAGEpJk4.</url>
            <title>Stories by MRINALI GUPTA on Medium</title>
            <link>https://medium.com/@mringupt?source=rss-a30a62d08d0c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 22:43:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mringupt/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Downloading OpenImages Dataset in Google Drive using Colab]]></title>
            <link>https://medium.com/data-science/downloading-openimages-dataset-in-google-drive-using-colab-132502f0dbde?source=rss-a30a62d08d0c------2</link>
            <guid isPermaLink="false">https://medium.com/p/132502f0dbde</guid>
            <category><![CDATA[open-images]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[colab]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[MRINALI GUPTA]]></dc:creator>
            <pubDate>Fri, 24 Jul 2020 17:31:47 GMT</pubDate>
            <atom:updated>2020-07-26T23:05:07.633Z</atom:updated>
            <content:encoded><![CDATA[<h4>Downloading your Custom Dataset</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NMsiwi7SanSiuieQBgqEGw.png" /><figcaption><a href="https://storage.googleapis.com/openimages/web/index.html">https://storage.googleapis.com/openimages/web/index.html</a></figcaption></figure><p>Want to train your Computer Vision model on a custom dataset but don&#39;t want to scrape the web for the images. Try out OpenImages, an open-source dataset having ~9 million varied images with 600 object categories and rich annotations provided by google. The dataset contains image-level labels annotations, object bounding boxes, object segmentation, visual relationships, localized narratives, and more.</p><p>You can download the specific categories as per your interest instead of downloading the whole dataset. In this article, we will download some selected classes/categories using google colab and will save the data in Google Drive. You can use jupyter notebook as well in your local runtime.</p><p><em>For this article, you need a google account and some space in google drive to download the data.</em></p><ol><li>Mount your Google Drive in Colab.</li></ol><p>2. Create a folder where your data should be stored. Here, I have created a directory named <strong>OpenImages.</strong></p><pre>!mkdir OpenImages</pre><p>3. Change the working directory to the folder you have just created. Confirm your working directory using “!pwd” command.</p><pre>cd OpenImages</pre><p>4. Run the below commands to download the annotations files for train, test, and validation along with the class file.</p><pre><em># Download required meta-files</em><br><em>!wget https://storage.googleapis.com/openimages/2018_04/class-descriptions-boxable.csv</em><br> <br><em>!wget https://storage.googleapis.com/openimages/2018_04/train/train-annotations-bbox.csv</em><br> <br><em>!wget https://storage.googleapis.com/openimages/2018_04/validation/validation-annotations-bbox.csv</em><br> <br><em>!wget https://storage.googleapis.com/openimages/2018_04/test/test-annotations-bbox.csv</em></pre><p>5. Use the GitHub link to save the downloadOI.py in your working directory(<a href="https://github.com/spmallick/learnopencv/blob/master/downloadOpenImages/downloadOI.py">https://github.com/spmallick/learnopencv/blob/master/downloadOpenImages/downloadOI.py</a>) or copy the code present in the link and create the file directly as shown below. (Thanks to <strong>Sataya Mallick</strong>/<strong>learnopencv</strong> for this amazing code repository. Do check out this amazing Github repository if you are interested in Computer Vision and OpenCV).</p><pre>#This magic function is used to create the files.downloadOI.py is the file name<br>%%writefile downloadOI.py</pre><pre>#Author : Sunita Nayak, Big Vision LLC<br><br>#### Usage example: python3 downloadOI.py --classes &#39;Ice_cream,Cookie&#39; --mode train<br><br>import argparse<br>import csv<br>import subprocess<br>import os<br>from tqdm import tqdm<br>import multiprocessing<br>from multiprocessing import Pool as thread_pool<br><br>cpu_count = multiprocessing.cpu_count()<br><br>parser = argparse.ArgumentParser(description=&#39;Download Class specific images from OpenImagesV4&#39;)<br>parser.add_argument(&quot;--mode&quot;, help=&quot;Dataset category - train, validation or test&quot;, required=True)<br>parser.add_argument(&quot;--classes&quot;, help=&quot;Names of object classes to be downloaded&quot;, required=True)<br>parser.add_argument(&quot;--nthreads&quot;, help=&quot;Number of threads to use&quot;, required=False, type=int, default=cpu_count*2)<br>parser.add_argument(&quot;--occluded&quot;, help=&quot;Include occluded images&quot;, required=False, type=int, default=1)<br>parser.add_argument(&quot;--truncated&quot;, help=&quot;Include truncated images&quot;, required=False, type=int, default=1)<br>parser.add_argument(&quot;--groupOf&quot;, help=&quot;Include groupOf images&quot;, required=False, type=int, default=1)<br>parser.add_argument(&quot;--depiction&quot;, help=&quot;Include depiction images&quot;, required=False, type=int, default=1)<br>parser.add_argument(&quot;--inside&quot;, help=&quot;Include inside images&quot;, required=False, type=int, default=1)<br><br>args = parser.parse_args()<br><br>run_mode = args.mode<br><br>threads = args.nthreads<br><br>classes = []<br>for class_name in args.classes.split(&#39;,&#39;):<br>    classes.append(class_name)<br><br>with open(&#39;./class-descriptions-boxable.csv&#39;, mode=&#39;r&#39;) as infile:<br>    reader = csv.reader(infile)<br>    dict_list = {rows[1]:rows[0] for rows in reader}<br><br>subprocess.run([&#39;rm&#39;, &#39;-rf&#39;, run_mode])<br>subprocess.run([ &#39;mkdir&#39;, run_mode])<br><br>pool = thread_pool(threads)<br>commands = []<br>cnt = 0<br><br>for ind in range(0, len(classes)):<br>    <br>    class_name = classes[ind]<br>    print(&quot;Class &quot;+str(ind) + &quot; : &quot; + class_name)<br>    <br>    subprocess.run([ &#39;mkdir&#39;, run_mode+&#39;/&#39;+class_name])<br><br>    command = &quot;grep &quot;+dict_list[class_name.replace(&#39;_&#39;, &#39; &#39;)] + &quot; ./&quot; + run_mode + &quot;-annotations-bbox.csv&quot;<br>    class_annotations = subprocess.run(command.split(), stdout=subprocess.PIPE).stdout.decode(&#39;utf-8&#39;)<br>    class_annotations = class_annotations.splitlines()<br><br>    for line in class_annotations:<br><br>        line_parts = line.split(&#39;,&#39;)<br>        <br>        #IsOccluded,IsTruncated,IsGroupOf,IsDepiction,IsInside<br>        if (args.occluded==0 and int(line_parts[8])&gt;0):<br>            print(&quot;Skipped %s&quot;,line_parts[0])<br>            continue<br>        if (args.truncated==0 and int(line_parts[9])&gt;0):<br>            print(&quot;Skipped %s&quot;,line_parts[0])<br>            continue<br>        if (args.groupOf==0 and int(line_parts[10])&gt;0):<br>            print(&quot;Skipped %s&quot;,line_parts[0])<br>            continue<br>        if (args.depiction==0 and int(line_parts[11])&gt;0):<br>            print(&quot;Skipped %s&quot;,line_parts[0])<br>            continue<br>        if (args.inside==0 and int(line_parts[12])&gt;0):<br>            print(&quot;Skipped %s&quot;,line_parts[0])<br>            continue<br><br>        cnt = cnt + 1<br><br>        command = &#39;aws s3 --no-sign-request --only-show-errors cp s3://open-images-dataset/&#39;+run_mode+&#39;/&#39;+line_parts[0]+&#39;.jpg &#39;+ run_mode+&#39;/&#39;+class_name+&#39;/&#39;+line_parts[0]+&#39;.jpg&#39;<br>        commands.append(command)<br>        <br>        with open(&#39;%s/%s/%s.txt&#39;%(run_mode,class_name,line_parts[0]),&#39;a&#39;) as f:<br>            f.write(&#39;,&#39;.join([class_name, line_parts[4], line_parts[5], line_parts[6], line_parts[7]])+&#39;\n&#39;)<br><br>print(&quot;Annotation Count : &quot;+str(cnt))<br>commands = list(set(commands))<br>print(&quot;Number of images to be downloaded : &quot;+str(len(commands)))<br><br>list(tqdm(pool.imap(os.system, commands), total = len(commands) ))<br><br>pool.close()<br>pool.join()</pre><p>6. The content in the directory <strong>OpenImages</strong> should look like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8zVRan4eg1dmpkokveFMKw.png" /><figcaption>The content of the directory</figcaption></figure><p>7. Run the below command to avoid “<strong>aws: not found sh: 1: aws: not found</strong>” error.</p><pre>!pip install awscli</pre><p>8. Downloading the specific data. Here I am downloading 2 classes <strong>Sink</strong> and <strong>Toilet</strong>. You can try multiple classes and download the data. You can find all the class names in the “<strong><em>class-descriptions-boxable.csv</em></strong><em>”.</em></p><pre><em># Download Sink and Toilet images for test</em> <br>!python3 downloadOI.py --classes &quot;Sink,Toilet&quot; --mode test</pre><pre><em># Download Sink and Toilet images for train<br></em>!python3 downloadOI.py --classes &quot;Sink,Toilet&quot; --mode train</pre><pre><em># Download Sink and Toilet images for validation<br></em>!python3 downloadOI.py --classes &quot;Sink,Toilet&quot; --mode validation</pre><p>There are 3 mode options you can choose</p><p><em>a) </em><strong><em>— mode train</em></strong><em>: To download the training data</em></p><p><em>b)</em><strong><em> — mode test</em></strong><em>: To download the test data</em></p><p><em>c)</em><strong><em> — mode validation</em></strong><em>: To download the validation data</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*JC5nnSOZk0LWK0E9ulLBcg.png" /><figcaption>This is how the downloaded data will look</figcaption></figure><p>Each Category has an image file along with its annotations in a text file.</p><ul><li>Filepath: OpenImages/train/Sink/01681d52ad599ab4.jpg</li><li>Image File: 01681d52ad599ab4.jpg</li><li>TextFile: 01681d52ad599ab4.txt</li><li>TextFile Content : Sink,0.249529,0.420054,0.659844,0.682363</li></ul><p>.txt file has the dimensions of the bounding boxes. It can have multiple entries in case if the image has multiple objects.</p><p><strong>Note: Keep in mind that every time you run this command the old data will get deleted. So if you want to use the command again, better try it in some other folder to avoid the deletion of the previous downloading data.</strong></p><p>That’s all. Play around with it and download the custom data to train your custom computer vision model.</p><p>Github link to the code <a href="https://github.com/mringupt/Colab/blob/master/Downloading_OpenImages_Custom_Dataset.ipynb">https://github.com/mringupt/Colab/blob/master/Downloading_OpenImages_Custom_Dataset.ipynb</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=132502f0dbde" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/downloading-openimages-dataset-in-google-drive-using-colab-132502f0dbde">Downloading OpenImages Dataset in Google Drive using Colab</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A beginner guide to Statistics for Data Science Part-I]]></title>
            <link>https://medium.com/data-science/a-beginner-guide-to-statistics-for-data-science-part-i-741f4d92560b?source=rss-a30a62d08d0c------2</link>
            <guid isPermaLink="false">https://medium.com/p/741f4d92560b</guid>
            <category><![CDATA[statistics]]></category>
            <dc:creator><![CDATA[MRINALI GUPTA]]></dc:creator>
            <pubDate>Tue, 12 May 2020 08:12:05 GMT</pubDate>
            <atom:updated>2020-05-12T13:55:51.999Z</atom:updated>
            <content:encoded><![CDATA[<h4>What, Why &amp; How of Statistics</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*o4_biQLiPHwDEIqGXfiEsQ.png" /><figcaption>Created using WordCloud in python, <a href="https://github.com/mringupt/Colab/blob/master/CreateWordCloud.py">Github code</a></figcaption></figure><p>What is Statistics? Why do we need Statistics? How to do data analysis using statistics? What is a population? Why we have samples? …….and the list goes on. Well, these are some of the very few questions any beginner will ask when first trying to jump into the field. In this post and the coming ones, I will be explaining the basic concepts of statistics in a super-easy way. So stay tuned!!</p><p><strong>What is Statistics?</strong></p><p>As per Wikipedia, “<a href="https://en.wikipedia.org/wiki/Statistics"><strong>Statistics</strong></a> is a mathematical science pertaining to the collection, analysis, interpretation, and presentation of data.”</p><p>It is a science of learning and making decisions from the data. Nothing more nothing less.</p><p><strong>Why we need statistics?</strong></p><p>We are living in the Digital Age where at each point, we are generating data i.e. information. Much of this information was interpreted mathematically by using statistics. For example, if you search the average height of an Indian in google it will say 5 feet. How? Do you think they asked every one of the whole <strong>1.33 billion</strong> people? Well, it’s hard to ask(considering time, money, and resources)….Then how come they say that the average height of Indians is 5 feet. It’s all because of Statistics and its various methods that interpret the population of interest.</p><p>Statistics provides tools to understand the data much better. When used correctly, statistics tell us any trends in what happened in the past and can be useful in predicting what may happen in the future.</p><p>The first and foremost thing in statistics is to understand what of population and Sample and what’s the difference between both of them.</p><ul><li><strong>Population: </strong>In layman terms, a population includes everyone and everybody in which you are interested. For example, if you are interested in finding the average weight of humans in a specific country (let’s say India), then every person of the country comes under your population data.</li><li><strong>Sample: </strong>A subset of the population that is chosen randomly. The sole purpose of statistics is to find something important about the population but considering the size of the population, getting the data of the whole population is impractical and required tons of resources and time. So usually we collect a sample that represents the overall population.</li></ul><p>Usually, Statistics is divided into 2 parts:</p><ol><li><strong>Descriptive Statistics</strong>: It is the part of statistics that describes the data(sample/seen data) or gives a summary of the data either through numerical calculations or graphs or tables. or example, let’s say you have a class of 100 students studying Physics. Now you may be interested in the overall performance of these students in mid-term. Descriptive statistics allow us to do it. <br>Descriptive Statistics, however, does not allow to draw conclusions beyond the data(on population). It just simply explains what data you have.<br> <br>Typically, there are two types of statistic that are used to describe data:</li></ol><ul><li><strong>Measures of central tendency:</strong> These are ways of describing the central position of data i.e a single value which tells where the center of the data lies. The central position of the data can be described using <strong><em>mean</em></strong>, <strong><em>mode,</em></strong> and <strong><em>median</em></strong>.</li><li><strong>Measures of spread:</strong> These are ways of summarizing the data by describing how much the data is dispersed about the central tendency. For example, the mean score of our 100 students in the test maybe 80 out of 100. However, not all students will have a score of 80. Rather, their scores will be spread out. Some will be higher than 80 and others lower. Measures of spread help us to summarize how much disperse the data is around the central tendency. To describe this spread, several statistics are available, including the <strong><em>variance</em>, <em>standard deviation</em>, <em>quartiles</em></strong>, etc.</li></ul><p><strong>2. Inferential Statistics</strong>: It is the part of statistics that draws conclusions about the population parameters such as mean, mode, median based on the sample taken from the population. It is, therefore, important that the sample accurately represents the population. It includes sampling and hypothesis testing. For example, you have data of 100 students score studying physics. You want to conclude scores of all of the students studying physics in a city, Inferential statistic helps you to achieve this.</p><p><strong>Mean(Average)</strong></p><p>It is the average of all the data points. If you have <em>n</em> data points <em>x1,x2,x3,…,xn </em>then the mean of the data will be</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/294/1*n7Rdmv7c3OBP8uKqa-KVCw.png" /><figcaption>Sample Mean Formula</figcaption></figure><p><strong>x̅</strong> (x-bar) represents the Sample Mean in Statistic.<br>The above formula can also be represented using a Greek Symbol <strong>Σ</strong>(sigma)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/160/1*fnEgfWhlMjSbtfXqtOBQuA.png" /><figcaption>Sample Mean Formula</figcaption></figure><p>Similarly, when we calculate the average of the whole population of size <strong><em>N</em></strong>, it is called a Population Mean and is represented by <strong>μ</strong>(mu)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/146/1*RantsrTha5FKzqM66alsCQ.png" /><figcaption>Population Mean Formula</figcaption></figure><p><strong>Median</strong></p><p>It is the value that separates the higher half from the lower half of the data sample. It is the midpoint of the data when sorted.</p><p>To calculate the mean of n data points, simply sort the data and find the middle element. There can be 2 different cases:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*HH8StcnKmFylmGVZWlRtxQ.png" /><figcaption>Image Source: <a href="https://www.teachoo.com/8364/2738/Median/category/Median/">https://www.teachoo.com/</a></figcaption></figure><p>For Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*an1CLf4FnapWb3sYCj8yyg.png" /><figcaption>Image Source: <a href="https://en.wikipedia.org/wiki/Median">Wikipedia</a></figcaption></figure><p>The main advantage of using the median in describing data as compared to mean is for skewed data(data where outliers are present, Outliers refer to the values distinct from the majority of the observations. These occur either naturally, due to equipment failure, or because of entry mistakes.). Median describes the data much more accurately in case of skewed data.</p><p>For example, consider the income of an individual in the US. The data is highly skewed if you consider Bill Gates’s income as one of the data points in your sample which is enormous as compared to any normal individual in the US making the data highly skewed. Therefore in such cases describing your data via mean will not be an approximate choice as mean will mostly represent the Bill Gates salary. Median income, therefore, will be a better way to represent the income of an individual in the US.</p><p><strong>Mode</strong></p><p>It is the most common value in the dataset i.e the value that occurs more frequently in the data. For example, the mode of the sample [1, 3,3,3,3, 6, 6, 6, 7,7,7,7, 7, 7, 12, 12, 17] is 7. The mode is most easily understandable and quickly visible. Many decisions in day-to-day life are taken on the modal concept like going to watch a movie where most people are going or choosing the type of icecream most people are buying.</p><p>If the data contains multiple values that are occurring the most frequently, you have a multimodal distribution. If no value duplicates, the data do not have a mode. Typically, you use the mode with categorical, ordinal, and discrete data.</p><p>The mode is the only measure of central tendency that you can use with categorical data(data points that are divided into categories)-such as the most preferred place to visit in India.</p><p><strong>Which one to use Mean/Mode/Median?</strong></p><p>It all depends on what type of data you have. If your data is symmetric, the mean is the best one to describe the center of the data. In case your data is highly skewed go with median and in case your data is mostly categorical go with mode.</p><p><strong>Variance</strong></p><p>It is the average squared deviation from the mean. A high variance means that the data is highly spread out whereas a small variance signifies the data to be closely clustered. Population Variance is denoted by σ² whereas sample variance is denoted by s².</p><p>Let’s consider a sample population of n elements, x1,x2,…,xn. with a sample population mean of <strong>x̅. </strong>The sample variance of the data is the average squared distance between the sample mean and each data value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/255/1*zdgp5HhXpZDErC0bi2mYaQ.png" /><figcaption>Sample Population Variance Formula</figcaption></figure><p>Similarly, for Population Variance</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*Gq4uYORZdwDPZsum2q9fqg.png" /><figcaption>Population Variance Formula</figcaption></figure><p>Why n-1 is there under sample variance calculation? <em>The sample variance equates out to be always smaller than the population variance hence, degrees of freedom is accounted for as the conversion factor. This is known as </em><a href="https://en.wikipedia.org/wiki/Bessel%27s_correction"><strong>Bessel’s correction</strong></a><strong>.</strong></p><p><strong>Standard Deviation</strong></p><p>Just like variance, Standard deviation is also the measure of the spread of data points from the mean. The only difference is that it is a square root of the variance. This enables it to have the same unit as that of the data and thus provides ease in understanding explanations from insights. Population Standard Deviation is denoted by σ whereas Sample Standard Deviation is denoted by s.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/1*XHze9Yv-eQ4qzii720Lyzw.png" /><figcaption>Sample Standard Deviation Formula</figcaption></figure><p>Similar to mean, Standard deviation is also highly affected by outliers and skewed distributions.</p><p>Why measure Standard Deviation instead of variance?</p><ul><li><em>Because Standard Deviation has the same units as original</em> <em>observations.</em></li><li><em>It is the natural measure of spread in a Gaussian(Normal) Distribution.</em></li></ul><p>That’s all for now. Stay tuned for the next post with other useful concepts. Happy Learning 😊.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=741f4d92560b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/a-beginner-guide-to-statistics-for-data-science-part-i-741f4d92560b">A beginner guide to Statistics for Data Science Part-I</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to fetch Kaggle Datasets into Google Colab]]></title>
            <link>https://medium.com/analytics-vidhya/how-to-fetch-kaggle-datasets-into-google-colab-ea682569851a?source=rss-a30a62d08d0c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea682569851a</guid>
            <category><![CDATA[kaggle]]></category>
            <category><![CDATA[colab]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[MRINALI GUPTA]]></dc:creator>
            <pubDate>Sun, 12 Jan 2020 14:58:34 GMT</pubDate>
            <atom:updated>2020-11-07T13:24:08.560Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*q6Bmq8Vr3gXLozhoXCez8g.png" /><figcaption>Kaggle to Google Colab</figcaption></figure><p>I think everyone interested in the Data Science field has heard of 2 popular words <strong>Kaggle</strong> and <strong>Colab. </strong>There is no doubt that Google Colab is the easiest way to build and publish your work without any tedious process of installing libraries and other dependencies while creating your ML model. It also provides free GPU and TPU services for the users(Google is great 👏).</p><p>Coming back to the point, I was finding a way to use Kaggle dataset into google colab. While struggling for almost 1 hour, I found the easiest way to download the Kaggle dataset into colab with minimal effort. Here I am providing a step by step guide to fetch data without any hassle.</p><blockquote>You must have a Google as well as a Kaggle account to proceed with the below steps.</blockquote><h3><strong>Step 1:Get you Kaggle API Token</strong></h3><ul><li>Go to <strong>Your Account </strong>and click on <strong>Create New API Token.</strong></li><li>A file named <strong>kaggle.json</strong> will get downloaded containing your username and token key</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rsqWlvLzJZ2cNy8wR4it-g.png" /></figure><h3>Step 2: Uploading kaggle.json into Google Drive</h3><ul><li>Create a folder named <strong>Kaggle</strong> where we will be storing our Kaggle datasets</li><li>Upload your kaggle.json file into Kaggle folder</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ck7tx-CiJ9kODRAKgXEOQQ.png" /><figcaption>Refer this image for the final result</figcaption></figure><h3>Step 3: Create a new Colab notebook</h3><h3>Step 4: Mount the drive to colab notebook</h3><ul><li>Use the below code to mount your google drive</li></ul><pre>from google.colab import drive<br>drive.mount(&#39;/content/gdrive&#39;)</pre><ul><li>Get your authorization code using the URL prompted and provide it in the empty box as shown in figure</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5_jOytkfKBHwyZKVl0ndUw.png" /></figure><h3>Step 4: Run the following code to provide the config path to kaggle.json</h3><pre>import os<br>os.environ[&#39;KAGGLE_CONFIG_DIR&#39;] = &quot;/content/gdrive/My Drive/Kaggle&quot;</pre><pre># <strong>/content/gdrive/My Drive/Kaggle</strong> is the path where kaggle.json is present in the Google Drive</pre><h3>Step 5: Change your present working directory</h3><pre>#changing the working directory<br>%cd /content/gdrive/My Drive/Kaggle</pre><pre>#Check the present working directory using <strong>pwd</strong> command</pre><h3>Step 6: Download the kaggle dataset</h3><ul><li>Go to kaggle and copy the <strong>API Command</strong> to download the dataset</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*EgvWkUzP0lMoDvxF6tBJLg.png" /></figure><ul><li>Your <strong>API Command </strong>will look like “<em>kaggle datasets download -d datasnaek/youtube-new</em>”</li><li>Run the following code using <strong>! </strong>:</li></ul><pre>!kaggle datasets download -d datasnaek/youtube-new</pre><ul><li>You can check the content in your directory using <strong>ls</strong> command as follows:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*ftuRmHyIIXQpjTM8-xauRA.png" /></figure><h3>Step 7: Unzip your data and remove the zip file</h3><ul><li>Use the <strong>unzip</strong> and <strong>rm</strong> command</li></ul><pre>#unzipping the zip files and deleting the zip files<br>!unzip \*.zip  &amp;&amp; rm *.zip</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*TdE6_609_zhd70y__opt5w.png" /></figure><p>That’s all folks …Now you can use the extracted .csv files with ease directly from your Google Drive.</p><p>Happy Learning 😃….</p><p>P.S. — For more google colab tips,do checkout this amazing article from <strong>neptune.ai </strong>on<em> </em><a href="https://neptune.ai/blog/google-colab-dealing-with-files"><em>How to Deal with Files in Google Colab: Everything You Need to Know</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea682569851a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/how-to-fetch-kaggle-datasets-into-google-colab-ea682569851a">How to fetch Kaggle Datasets into Google Colab</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>