<?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 Muhammad Asyhar on Medium]]></title>
        <description><![CDATA[Stories by Muhammad Asyhar on Medium]]></description>
        <link>https://medium.com/@muhammadasyhar?source=rss-a0abe552a4e2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*fEM96zC8U4eG6xrr</url>
            <title>Stories by Muhammad Asyhar on Medium</title>
            <link>https://medium.com/@muhammadasyhar?source=rss-a0abe552a4e2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 20:13:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@muhammadasyhar/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[Google Colab Tutorial : How to Read CSV stored in Google Drive]]></title>
            <link>https://medium.com/@muhammadasyhar/google-colab-tutorial-how-to-read-csv-stored-in-google-drive-780010bb312?source=rss-a0abe552a4e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/780010bb312</guid>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[google-colab]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Muhammad Asyhar]]></dc:creator>
            <pubDate>Tue, 15 Nov 2022 04:19:05 GMT</pubDate>
            <atom:updated>2022-11-27T00:35:32.609Z</atom:updated>
            <content:encoded><![CDATA[<h3>Google colab : how to read CSV stored in google drive</h3><p>When starting a data project, one of the first things a data scientist does is read data. This data can be in various formats, but one format that we often encounter is comma separated values (csv).</p><p>In this tutorial, we will demonstrate how to read a .csv file stored on Google Drive.</p><p>The first thing to do before reading a file on Google Drive is to mount it. Mounting can be done using the side menu on Google Colab: Files &gt; Mount Drive &gt; Connect to Google Drive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*C--pY2yOPZKZYFSd36Q_cw.png" /><figcaption>Mount Drive Menu</figcaption></figure><p>Once successful, the drive mount icon will change (strike out) and the drive folder will appear.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*nLOFjDGenWgY85LZhNL1sA.png" /><figcaption>Drive Mounted Succesfully</figcaption></figure><p>Next, select the file to be read, then right-click on the file and select copy path to copy the file address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*DMAqmtFYI4hrpEiAQL73PQ.png" /><figcaption>File Address Copy</figcaption></figure><p>Finally, use pandas read_csv(file address) to read the file.</p><pre>import pandas as pd <br><br>df = pd.read_csv(&#39;/content/drive/MyDrive/Colab Notebooks/dataset/global air pollution dataset.csv&#39;)<br>df</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dKHX4uNjLfB6mNWJpg9lAw.png" /></figure><p>That’s a short tutorial from me, I hope it’s useful. Thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=780010bb312" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create dataframe from SQL database in Google Colab]]></title>
            <link>https://medium.com/@muhammadasyhar/how-to-create-dataframe-from-sql-relational-database-in-google-colab-895eb86a6e10?source=rss-a0abe552a4e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/895eb86a6e10</guid>
            <category><![CDATA[pandas-dataframe]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[google-colab]]></category>
            <category><![CDATA[sqlite]]></category>
            <dc:creator><![CDATA[Muhammad Asyhar]]></dc:creator>
            <pubDate>Fri, 11 Nov 2022 02:38:17 GMT</pubDate>
            <atom:updated>2022-11-14T01:59:34.236Z</atom:updated>
            <content:encoded><![CDATA[<p>Google Colab is a free, simple, and powerful platform for data scientist. Google Colab is a great tool to transform data, to analyze, and to build a predictive model.</p><p>In data science, you almost need a dataframe in every project as the basis for modeling. So, in this post we will walk you through how to create dataframe from SQL database in Google Colab.</p><p>As a sample, we use <a href="https://www.sqlitetutorial.net/wp-content/uploads/2018/03/chinook.zip">chinook.db</a> from sqlitetutorial.net as our Database.</p><p>Before we start, make it sure to upload our database to Google Drive. Take a look at the illustration of the database tables and their relationships below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*HExYQdTRRz2qHAR7unvYoQ.jpeg" /><figcaption><a href="https://www.sqlitetutorial.net/wp-content/uploads/2015/11/sqlite-sample-database-color.jpg">https://www.sqlitetutorial.net/wp-content/uploads/2015/11/sqlite-sample-database-color.jpg</a></figcaption></figure><p>As the sample is ready, so let’s jump straight into the tutorial.</p><p>First thing first, we need to mount Google Colab to Google Drive to get access to Google Drive’s File and Directory.</p><pre>from google.colab import drive<br>drive.mount(&#39;/content/drive&#39;)</pre><p>Second, we need to connect and load our Database by using SQLite3 library.</p><pre>import sqlite3<br>conn = sqlite3.connect(&#39;/content/drive/MyDrive/Colab Notebooks/db/chinook.db&#39;)</pre><p>Third, we need to write some SQL Query to select and join columns from our Database before we make it as dataframe.</p><pre>sql = &#39;&#39;&#39;<br> SELECT INVI.InvoiceLineId, INV.InvoiceDate, TR.name as TrackName, TR.Composer, GR.name as Genre, INVI.UnitPrice, INVI.Quantity, INVI.UnitPrice*INVI.Quantity as Sales<br> FROM invoice_items INVI<br> JOIN invoices INV on INVI.InvoiceId = INV.InvoiceId<br> JOIN tracks TR on INVI.TrackId = TR.TrackId <br> JOIN genres GR on TR.GenreId = GR.GenreId<br>&#39;&#39;&#39;</pre><p>Finally, we need to use the pandas read_sql method to create the dataframe.</p><pre>import pandas as pd<br>df = pd.read_sql(sql,conn)<br>df.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qmfilllhZgSxxBGM4t5e5Q.jpeg" /></figure><p>That’s all from me, have a good day. Thank you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=895eb86a6e10" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>