<?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 Dylan Song on Medium]]></title>
        <description><![CDATA[Stories by Dylan Song on Medium]]></description>
        <link>https://medium.com/@dylanhgs?source=rss-61f0fa50e3f3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dwzY9aZBIJzR9a_RwF4_2g.jpeg</url>
            <title>Stories by Dylan Song on Medium</title>
            <link>https://medium.com/@dylanhgs?source=rss-61f0fa50e3f3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 19:55:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dylanhgs/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[The Simple Tool to Build a Web Bot in Python]]></title>
            <link>https://medium.com/data-and-beyond/the-simple-tool-to-build-a-web-bot-in-python-4d263d62084b?source=rss-61f0fa50e3f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d263d62084b</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Dylan Song]]></dc:creator>
            <pubDate>Fri, 05 Apr 2024 00:00:00 GMT</pubDate>
            <atom:updated>2024-04-06T09:36:40.240Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xXL39Z102GBe7QAf" /></figure><h3>Table of Contents</h3><p>· <a href="#74c5">Introduction</a><br>· <a href="#221b">Importing the Selenium Library</a><br>· <a href="#c1f0">Opening Wikipedia on Google Chrome</a><br>· <a href="#ae62">Short Video</a></p><h3>Introduction</h3><p>In this blog, I’ll show you how to <strong>automate</strong> the process of <strong>opening a website</strong> in Python, and at the end, I’ll provide you with a <strong>short video</strong> that will <strong>walk you through</strong> all the steps. The best thing about this is that it’s really easy to do and only requires a <strong>few lines</strong> of code!</p><h3>Importing the Selenium Library</h3><p>Selenium is a library that lets your Python program <strong>interact with the web browser</strong>. To import this library, here’s what you have to type:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/0*82fAWqOAHoXGq5Zd" /></figure><p>I’m also going to import another library called <strong>“webdriver_manager”</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/0*PL38eqf6xnPhFQcb" /></figure><p>You’ll see why I import this library in the <strong>next part</strong>.</p><h3>Opening Wikipedia on Google Chrome</h3><p>I’m going to create a variable called <strong>“driver”</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/0*GNDsvIXFTn7F6Ri0" /></figure><p>This will install the <strong>ChromeDriverManager</strong>, which will allow the Python program to <strong>open a Google Chrome browser</strong>. Now, we have to tell Python <strong>what</strong> to do with Chrome.</p><p>In this example, I’m going to try to let Python open up the main <strong>Wikipedia</strong> page on Google Chrome. So, I need to <strong>copy the URL</strong> of Wikipedia and paste it inside the <strong>“get”</strong> method:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/499/0*SttG9utE975tR_Wl" /></figure><p>If you run the program, then you should get something that looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pgp3VewEszTrdK_W" /></figure><h3>Short Video</h3><p>Alright, that’s all I got for this one! If there’s <strong>anything confusing</strong> about this blog post, then make sure to check out the video below because it may be easier to <strong>follow along with a video</strong> rather than with an article. Hope to see you there, and thanks for reading!</p><p><a href="https://youtube.com/shorts/QqoCmEZ1EH0">the simple tool to build a web bot in python #shorts</a></p><p><em>Originally published at </em><a href="https://dylans0ng.github.io/2024/04/05/simple-tool-web-bot-python.html"><em>https://dylans0ng.github.io</em></a><em> on April 5, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d263d62084b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-and-beyond/the-simple-tool-to-build-a-web-bot-in-python-4d263d62084b">The Simple Tool to Build a Web Bot in Python</a> was originally published in <a href="https://medium.com/data-and-beyond">Data And Beyond</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scrape Data from Any Website in Excel]]></title>
            <link>https://medium.com/data-and-beyond/scrape-data-from-any-website-in-excel-6d4acfd1e99e?source=rss-61f0fa50e3f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d4acfd1e99e</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[excel]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[data-analytics]]></category>
            <dc:creator><![CDATA[Dylan Song]]></dc:creator>
            <pubDate>Sat, 03 Feb 2024 00:00:24 GMT</pubDate>
            <atom:updated>2024-02-04T12:04:21.432Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Uj6kGUFQJY8n-Bdn" /></figure><h3>Table of Contents</h3><p>· <a href="#da0a">Intro</a><br>· <a href="#e62e">Pasting in the URL</a><br>· <a href="#99b8">Choosing the Right Table</a><br>· <a href="#e29c">Conclusion</a></p><h3>Intro</h3><p>If you come across an article that contains data that you’re interested in, then there’s an easy way to <strong>import that data</strong> into Excel. Here’s how to do it…</p><h3>Pasting in the URL</h3><p>First, you have to go to the “Data” ribbon and click on <strong>“From Web”</strong>, which will show you something that looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/0*aEKAc1wMSqq0-bfw" /></figure><p>All you have to do is <strong>paste in the URL</strong> of the website. In my case, I’ll paste in a <strong>Wikipedia article</strong> that contains video game sales:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/0*r2APWamdyMzCF3rx" /></figure><h3>Choosing the Right Table</h3><p>After you click on “OK”, you have to <strong>choose the table</strong> that contains the data that you’re interested in. This is because Excel <strong>sometimes detects other tables</strong> from the website, so you have to make sure to select the right sheet by <strong>looking at its preview</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/0*ixep-ac4kCetmyP-" /></figure><p>Since the preview for my data contains all the video game sales, I’m gonna click on <strong>“Transform Data”</strong> (do NOT click on “Load”!):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/0*xB2Wwseg9tRXpyOx" /></figure><p>This will take you to the <strong>Power Query Editor</strong>, which is the tool where you <strong>clean up</strong> the data:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*owSs4v43iVYoBEYD" /></figure><h3>Conclusion</h3><p>That’s pretty much all it takes to <strong>import data from a website</strong> into Excel. If you want to learn how to <strong>clean data</strong> inside the Power Query Editor, then check out this 6-minute video:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FbXapgAwYvX4%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DbXapgAwYvX4&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FbXapgAwYvX4%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/edac2b82bda3a98c3b4975f11c307a7e/href">https://medium.com/media/edac2b82bda3a98c3b4975f11c307a7e/href</a></iframe><p>Thank you for reading!</p><p><em>Originally published at </em><a href="https://dylans0ng.github.io/2024/02/03/scrape-data-excel.html"><em>https://dylans0ng.github.io</em></a><em> on February 3, 2024.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d4acfd1e99e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-and-beyond/scrape-data-from-any-website-in-excel-6d4acfd1e99e">Scrape Data from Any Website in Excel</a> was originally published in <a href="https://medium.com/data-and-beyond">Data And Beyond</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Export Data in Python with ONE LINE of Code!]]></title>
            <link>https://medium.com/data-and-beyond/export-data-in-python-with-one-line-of-code-caed817c90fd?source=rss-61f0fa50e3f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/caed817c90fd</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[excel]]></category>
            <category><![CDATA[pandas-dataframe]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Dylan Song]]></dc:creator>
            <pubDate>Sun, 31 Dec 2023 00:00:00 GMT</pubDate>
            <atom:updated>2023-12-31T23:51:59.023Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NM17TAn2GJWphDXSDwj4nA.png" /></figure><h3>Table of Contents</h3><p>· <a href="#4ab2">Introduction</a><br>· <a href="#28ab">The Dataset</a><br>· <a href="#e248">Importing the Pandas Library</a><br>· <a href="#a5e9">Importing the Kaggle Dataset</a><br>· <a href="#4c46">Creating a New Dataframe</a><br>· <a href="#383d">Exporting the Data</a><br>· <a href="#96fa">Conclusion</a></p><h3>Introduction</h3><p>If you want to permanently <strong>save some part of a dataset</strong>, then there’s a pretty easy way to do that in Python. This blog is going to show you how to <strong>export any data</strong> from your Python editor into your local computer.</p><p>So, let’s get into it!</p><h3>The Dataset</h3><p>For this blog, I’ll use a Kaggle dataset on <strong>Netflix movies and TV shows</strong>. You can click <a href="https://www.kaggle.com/datasets/maso0dahmed/netflix-movies-and-shows">here</a> to download the data and follow along!</p><h3>Importing the Pandas Library</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*H06pKLCKfVBViGpT" /></figure><p>This will import the Pandas library, which will allow us to <strong>import the dataset from Kaggle into Python</strong>.</p><h3>Importing the Kaggle Dataset</h3><p>To load the Netflix dataset, I have to use a method from pandas called <strong>read_csv()</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kBf1B9nity9Mzw7d" /></figure><p>Here, I just passed in the <strong>name of the file</strong> into the read_csv() function and stored it into a variable called <strong>df</strong>.</p><p>I also said <strong>df.head()</strong> because I wanted to take a <strong>quick look</strong> at the dataset. The <strong>head()</strong> method basically returned the <strong>first 5 rows</strong>.</p><h3>Creating a New Dataframe</h3><p>Let’s say that I want to create a separate dataset on <strong>ONLY </strong>the Netflix movies and <strong>NOT </strong>the TV shows. Using the dataframe I just created before, I can create <strong>another dataframe</strong> from the <strong>existing one</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/0*tg4xeAciw5FIl2-1" /></figure><p>Here, I created a new dataframe called <strong>“df_movies”</strong> and say that it’s equal to “df”, <strong>as long as df[‘Type’] is equal to ‘Movie’</strong>, which is indicated by the conditional inside the square brackets.</p><p>So, this line of code created another dataframe that stored data on <strong>only the Netflix movies</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MHgiHDie-996HJ0h" /></figure><h3>Exporting the Data</h3><p>Now, I’m finally going to <strong>export</strong> this new dataframe, and it’ll only take <strong>one line of code</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/0*yWw4DdZ9O2VNsnCV" /></figure><p>In this cell, I used the <strong>to_csv()</strong> function from Pandas, which would automatically save the Pandas dataframe as a <strong>local csv file</strong>. And the name of the csv file would be called <strong>“netflix_movies.csv”</strong> because that’s what I passed inside the to_csv() <strong>argument</strong>.</p><p>So, after I ran that, I got that dataframe saved into my <strong>local folder</strong>, the same one as the one my Python program was located in.</p><h3>Conclusion</h3><p>Alright, that’s it for this blog! Hopefully you learned something new and <strong>if you learn better by watching a video</strong>, then check out this video that I made:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FbybxYHRRYKM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DbybxYHRRYKM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FbybxYHRRYKM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/61cd1006a081ee15fd6680e4b370c892/href">https://medium.com/media/61cd1006a081ee15fd6680e4b370c892/href</a></iframe><p>Thanks for reading, and happy New Year!</p><p><em>Originally published at </em><a href="https://dylans0ng.github.io/2023/12/31/export-data-python-one-line-of-code.html"><em>https://dylans0ng.github.io</em></a><em> on December 31, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=caed817c90fd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-and-beyond/export-data-in-python-with-one-line-of-code-caed817c90fd">Export Data in Python with ONE LINE of Code!</a> was originally published in <a href="https://medium.com/data-and-beyond">Data And Beyond</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Create a TIMELINE SLICER for your Excel Dashboard!]]></title>
            <link>https://medium.com/data-and-beyond/create-a-timeline-slicer-for-your-excel-dashboard-eb718f69f719?source=rss-61f0fa50e3f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb718f69f719</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[excel]]></category>
            <category><![CDATA[data-analytics]]></category>
            <dc:creator><![CDATA[Dylan Song]]></dc:creator>
            <pubDate>Sat, 09 Dec 2023 00:00:18 GMT</pubDate>
            <atom:updated>2023-12-09T19:53:28.329Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*muqPoBCRngKSTX_P" /><figcaption>This is the visual you’ll create in the end!</figcaption></figure><h3>Table of Contents</h3><p>· <a href="#c411">Intro</a><br>· <a href="#ead8">What is a timeline slicer?</a><br>· <a href="#c2f6">Introducing the Dataset</a><br>· <a href="#4d86">Creating the Pivot Table</a><br>· <a href="#43c5">Building the Pivot Table</a><br>· <a href="#f02a">Creating the Timeline Slicer</a><br>· <a href="#ef3c">Video on Creating a Timeline Slicer</a></p><h3>Intro</h3><p>In this blog post, I’ll show you how to create a <strong>timeline slicer</strong> in Excel. It’s a pretty useful tool that will <strong>make your dashboard more interactive</strong>, especially if you have a timeline graph, because as you click on the different buttons on a timeline slicer, the <strong>values on all your other visuals will change</strong> based on the buttons you press.</p><p>I’ll explain more on this later, so keep reading!</p><h3>What is a timeline slicer?</h3><p>A timeline slicer is a <strong>filtering tool</strong> that lets you see values based on the <strong>certain dates or times</strong> that you filter on. You’ll see how it works in this example I’m about to show you…</p><h3>Introducing the Dataset</h3><p>To use the timeline slicer, I’m going to use a Kaggle dataset on <strong>Netflix movies and TV shows</strong> that you can find <a href="https://www.kaggle.com/datasets/maso0dahmed/netflix-movies-and-shows">here</a>.</p><p>Here’s a quick glance at the data:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6rCjrIH1qrDI38HP" /></figure><p>I formatted the <strong>“release_year”</strong> column as a date, which is going to be important for later. Also, I noticed that for some reason, <strong>all the dates are inaccurate</strong> because none of these movies and TV shows came out in 1905. They came out wayyy later.</p><p>However, I’m still gonna work with it because the point of this blog post is to show you <strong>HOW to create a timeline slicer</strong>, and you can apply this process to <strong>ANY other dataset</strong>.</p><h3>Creating the Pivot Table</h3><p>Before we create the timeline slicer, we have to first build a <strong>simple pivot table</strong>. So, click on the “Insert” ribbon and click on the <strong>“Pivot Table”</strong> button on the top left-hand corner:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*c-YMOSkGOG0lnIdw" /></figure><p>Make sure that the <strong>whole data</strong> is selected inside the range and click on “OK”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/0*Uw8q2o82oskuacYf" /></figure><p>Doing that’s gonna create a new worksheet where you can <strong>build the pivot table</strong>.</p><h3>Building the Pivot Table</h3><p>Inside the new worksheet, I’m going to drag the “age_certification” column into the <strong>“Rows”</strong> box and the “runtime” column into the <strong>“Values”</strong> box:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/341/0*1Vn-cLDgRVGtLiLG" /></figure><p>But I don’t want to get the SUM of the runtime values. I want to get the <strong>AVERAGE</strong>, so I’m going to click on the dropdown arrow next to “Runtime” and click on <strong>“Value Field Settings”</strong>. From there, I’ll click on <strong>“Average”</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/0*Lq2o0T0dSXcz5nmp" /></figure><p>Here’s what my pivot table looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/394/0*7dzrRkFLWN_QZDD_" /></figure><p>After you’ve finished building your pivot table, you can move on to the main part, which is <strong>creating the timeline slicer</strong>.</p><h3>Creating the Timeline Slicer</h3><p>Make sure you’re <strong>selected inside the pivot table</strong> and go to the “PivotTable Analyze” ribbon and click on the button that says <strong>“Insert Timeline”</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jOaJhoIH3tfn6BDq" /></figure><p>This is going to open a new pop-up window, and it shows the <strong>“release_year” column</strong>, so I’ll check that box:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/305/0*G4qIwfD27UFAgaUU" /></figure><p>If I didn’t format the “release_year” column as a date before, then <strong>this wouldn’t have worked</strong> because I can only create a timeline slicer <strong>if one of the columns are formatted as a date</strong> in the dataset.</p><p>Anyways, here’s what the timeline slicer should look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/0*c9tcNnorcKMbLbpW" /></figure><p>But there’s only one year in this whole dataset, so I’m going to change the timeline slicer to <strong>display the quarters</strong> instead of the years. So, I’ll click on the dropdown arrow next to “YEARS” and <strong>change it to “QUARTERS”</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/0*xa2LFnxFTWEQWBkL" /></figure><p>That’s going to show you <strong>4 quarters of the year</strong>, and you can click on each different quarter, which will <strong>change the values on the pivot table</strong> based on the quarter you select.</p><h3>Video on Creating a Timeline Slicer</h3><p>If you want to see a <strong>more interactive version</strong> of this blog post, check out a video that I made:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FeiIn1eVvUjc%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DeiIn1eVvUjc&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FeiIn1eVvUjc%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/bb7f3af4b4379175587f6966ef944317/href">https://medium.com/media/bb7f3af4b4379175587f6966ef944317/href</a></iframe><p>It’s a 5-minute video that will <strong>walk you through all the steps</strong> of creating a timeline slicer.</p><p>I hope to see you over there, and thank you so much for reading!</p><p><em>Originally published at </em><a href="https://dylans0ng.github.io/2023/12/09/create-timeline-slicer-excel-dashboard.html"><em>https://dylans0ng.github.io</em></a><em> on December 9, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb718f69f719" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-and-beyond/create-a-timeline-slicer-for-your-excel-dashboard-eb718f69f719">Create a TIMELINE SLICER for your Excel Dashboard!</a> was originally published in <a href="https://medium.com/data-and-beyond">Data And Beyond</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web Scraping Wikipedia Data Using Pandas [3 Steps]]]></title>
            <link>https://medium.com/data-and-beyond/web-scraping-wikipedia-data-using-pandas-3-steps-5959ae2a206b?source=rss-61f0fa50e3f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/5959ae2a206b</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[web-scraping]]></category>
            <dc:creator><![CDATA[Dylan Song]]></dc:creator>
            <pubDate>Sat, 11 Nov 2023 00:00:30 GMT</pubDate>
            <atom:updated>2023-11-12T06:53:45.841Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iKbT33oWE6rwzR_L" /><figcaption>Wikipedia Logo by <a href="https://en.wikipedia.org/wiki/Wikipedia_logo">Wikipedia</a></figcaption></figure><h3>Table of Contents</h3><p>· <a href="#53a5">Introduction</a><br>· <a href="#0226">Step 1: Import Libraries</a><br>· <a href="#8536">Step 2: Use the Read_html Method</a><br>· <a href="#94a3">Step 3: Check Which Table to Use</a><br>· <a href="#4742">Video on Web Scraping Wikipedia Data</a></p><h3>Introduction</h3><p>In this blog post, I’ll show you how to <strong>web scrape any data from Wikipedia</strong> in Python. It’s really easy to do and only requires <strong>3 steps</strong>! So, without wasting any more time, let’s jump into it…</p><h3>Step 1: Import Libraries</h3><p>First, you have to import the <strong>Pandas</strong> library:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/267/0*orv8IQBdwcM26TBQ" /></figure><p>Then, import the <strong>SSL</strong> library:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/783/0*O7GDJdTMz1wHX8W6" /></figure><p>It’s important to include the <strong>last line of code</strong> or else you <strong>might get an error</strong> saying that the certificate verification failed.</p><p>After you import both these libraries, you’re ready to move on to the next step…</p><h3>Step 2: Use the Read_html Method</h3><p>The <strong>read_html method</strong> is provided by the Pandas library and will automatically <strong>convert HTML tables into Pandas dataframes</strong>, making it easy for us to analyze the web data in Python. It requires <strong>one argument</strong> — the link of the website.</p><p>So, all you gotta do is <strong>create a new variable</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/0*pKsrMIOFqord9jhD" /></figure><p>In the code above, I created a new variable called “<strong>tables</strong>” and set it equal to the read_html method, with the <strong>Wikipedia article link as the argument</strong>. This means that “tables” will contain <strong>all data contained in an HTML table</strong> from the Wikipedia article.</p><p>However, we’re still not done yet. There’s one more thing to do…</p><h3>Step 3: Check Which Table to Use</h3><p>Depending on how big the article is, you might get <strong>multiple data tables</strong> when you scrape the website. Take a look at this, for example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/188/0*xUMdmyrChDeI5_0E" /></figure><p>Since my Wikipedia article is pretty big, there are <strong>4 HTML tables</strong> that Pandas automatically scraped. So, I need to find <strong>which data table has the correct information</strong> that I’m interested in — video game sales.</p><p>So, this will take some <strong>trial and error</strong>. You have to use <strong>indexing</strong> to find the table that you want:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/0*ygJ7ONrwKOgEa70f" /></figure><p>I obtained the <strong>first table</strong> within “tables” by putting a 0 inside the square brackets. Remember, Python uses <strong>zero-based indexing</strong>!</p><p>The first table doesn’t look like the one I want because it doesn’t include the video game sales. So, I’m gonna do the same thing, but this time I’ll get the <strong>second table</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Eo9gRNrRawWzeBbv" /></figure><p>This looks like the right one because it contains data on all the video game sales.</p><p>Once you <strong>find the data table</strong> that you want, you can save it into a <strong>new variable</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PJRmnQJ9rWg3SCKN" /></figure><p>Now, you can <strong>conveniently refer to this new variable</strong> when you do your analysis.</p><h3>Video on Web Scraping Wikipedia Data</h3><p>Ok, that’s all I got for this post! Hopefully, you found it helpful, but if there’s something that still doesn’t make sense, then I encourage you to check out a <strong>short 2-minute video</strong> that I made:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F0FKOugdhExw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D0FKOugdhExw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F0FKOugdhExw%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/94c45417cd1a5a3c06b4f9435e2bd0ab/href">https://medium.com/media/94c45417cd1a5a3c06b4f9435e2bd0ab/href</a></iframe><p>It’ll give you a more clear explanation on <strong>how to web scrape Wikipedia data</strong>. I hope to see you there, and thanks for reading!</p><p><em>Originally published at </em><a href="https://dylans0ng.github.io/2023/11/11/web-scrape-wiki-data-using-pandas.html"><em>https://dylans0ng.github.io</em></a><em> on November 11, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5959ae2a206b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-and-beyond/web-scraping-wikipedia-data-using-pandas-3-steps-5959ae2a206b">Web Scraping Wikipedia Data Using Pandas [3 Steps]</a> was originally published in <a href="https://medium.com/data-and-beyond">Data And Beyond</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Visualization Taken to a NEXT LEVEL: Dynamic Data Bars in Excel]]></title>
            <link>https://medium.com/data-and-beyond/data-visualization-taken-to-a-next-level-dynamic-data-bars-in-excel-2e500098260d?source=rss-61f0fa50e3f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e500098260d</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[excel]]></category>
            <dc:creator><![CDATA[Dylan Song]]></dc:creator>
            <pubDate>Wed, 20 Sep 2023 00:00:32 GMT</pubDate>
            <atom:updated>2023-09-21T07:23:26.997Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/311/0*dZnUGsnSLkktWEBz" /><figcaption>This is what you’ll make!</figcaption></figure><h3>Introduction</h3><p>In this post, I’ll show you how to create a <strong>simple visualization</strong> in Excel that you see above, and it’ll only take a <strong>couple steps</strong>! It’s basically a bar chart that’s actually <strong>INSIDE the cell</strong>. And in the end, I’ll provide you with a video that will provide a <strong>more detailed walkthrough</strong>, so make sure to keep reading till then!</p><h3>Conditional Formatting to Add the Data Bar</h3><p>So over here, I just have a simple table with all the months and the profits:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/366/0*ihGuNKhgYnTYNnWT" /></figure><p>First, you have to <strong>highlight</strong> all the numbers and go to the <strong>conditional formatting</strong> tool:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/0*EMWWpryleoXJEjW8" /></figure><p>What conditional formatting will do is take in all the numerical values and <strong>automatically create data bars</strong> based on what those values are.</p><p>So, after you click on that button, it’s gonna open a menu. From that menu, click on <strong>“Data Bars”</strong> and select on the <strong>color scales</strong> that you like the best!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/0*ZBC9ybczIj9mVI5Y" /></figure><p>Personally, I prefer the <strong>green color style</strong>, so I selected that one.</p><p>From my screen, you can see that the <strong>green bars</strong> represent the months where we made a profit, whereras the <strong>red bars</strong> represent months where we lost money. So, these data bars are a nice way of <strong>quickly gaining insights</strong> from your data.</p><h3>Data Bar on a Separate Cell</h3><p>But I wanna do one more thing.</p><p>I don’t like how the data bars are <strong>overlapping with the numbers</strong>. What I’m gonna do is move all these data bars onto a <strong>separate column</strong>.</p><p>This will require a <strong>couple more steps</strong>, but it’s still very easy to do! If you want to see me do this, then check out this <strong>short video</strong> that I made:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F-jgDfzE4JhY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D-jgDfzE4JhY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F-jgDfzE4JhY%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8cf51def258f770366373deec06bf803/href">https://medium.com/media/8cf51def258f770366373deec06bf803/href</a></iframe><p>I hope to see you over there, and thank you for reading this post!</p><p><em>Originally published at </em><a href="https://dylans0ng.github.io/2023/09/20/data-viz-next-level-data-bars-excel.html"><em>https://dylans0ng.github.io</em></a><em> on September 20, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e500098260d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-and-beyond/data-visualization-taken-to-a-next-level-dynamic-data-bars-in-excel-2e500098260d">Data Visualization Taken to a NEXT LEVEL: Dynamic Data Bars in Excel</a> was originally published in <a href="https://medium.com/data-and-beyond">Data And Beyond</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fastest Way to Show Descriptive Statistics in Excel]]></title>
            <link>https://medium.com/data-and-beyond/fastest-way-to-show-descriptive-statistics-in-excel-cb8b28e302fc?source=rss-61f0fa50e3f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb8b28e302fc</guid>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[excel]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Dylan Song]]></dc:creator>
            <pubDate>Sat, 02 Sep 2023 00:00:44 GMT</pubDate>
            <atom:updated>2023-09-03T06:40:42.202Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Uc1JSm8qlX49jv27" /><figcaption>We’re gonna analyze this McDonalds meal! (Photo by<a href="https://unsplash.com/@brett_jordan"> Brett Jordan</a> on <a href="https://unsplash.com/">Unsplash</a>)</figcaption></figure><h3>Table of Contents</h3><p>· <a href="#f904">Introduction</a><br>· <a href="#e59b">The “Data Analysis” Feature</a><br>· <a href="#9269">Enabling “Data Analysis”</a><br>· <a href="#7018">Using “Data Analysis”</a><br>· <a href="#da7a">Analyzing “Data Analysis”</a></p><h3>Introduction</h3><p>In this post, I’ll show you a <strong>quick way</strong> to show a list of <strong>descriptive statistics</strong> in Excel! And I’ll be analyzing a <strong>dataset on Big Mac prices</strong> and using a <strong>simple tool</strong> to get the mean, median, and more. Here’s the link to the dataset: <a href="https://www.kaggle.com/datasets/vittoriogiatti/bigmacprice">https://www.kaggle.com/datasets/vittoriogiatti/bigmacprice</a></p><p>So, make sure to <strong>read until the end</strong> if you’re interested in analyzing this data in only a <strong>couple of mouse clicks</strong>!</p><h3>The “Data Analysis” Feature</h3><p>The “<strong>Data Analysis</strong>” feature is an Excel <strong>add-in</strong> that is very useful when it comes to <strong>statistical summaries</strong>. For this post, we’ll use it to give us descriptive statistics of the Big Mac prices.</p><p>However, if you’re on the default Excel settings, then <strong>you won’t see the tool</strong>. Here’s how to enable it…</p><h3>Enabling “Data Analysis”</h3><p>First, click on the “File” ribbon and then on the <strong>bottom left hand corner</strong>, click on “<strong>Options</strong>”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/141/0*kKtqz2sP_tPOiX4y" /></figure><p>This will open a <strong>new pop-up window</strong> that looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/0*uKa_svvxU3EuWX-9" /></figure><p>From there, click on the <strong>“Add-Ins</strong>” section and then press “<strong>Go</strong>”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/0*NAG3uN9YPQI31wsQ" /></figure><p>This will take you to another window, and you have to select the box that says “<strong>Analysis ToolPak</strong>”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/280/0*u28p6VXR10YpHYji" /></figure><p>After you do that, if you go to the “Data” ribbon back in the <strong>Excel main interface</strong>, you’ll see a button that says “Data Analysis” in the <strong>top right corner</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_xWc6XLfNgBIaZOX" /></figure><p>So now, we’re ready to get started and create the <strong>list of descriptive statistics</strong>!</p><h3>Using “Data Analysis”</h3><p>If you click on the “Data Analysis” button, then Excel will show you a bunch of <strong>analysis tools</strong> that it’ll <strong>automatically</strong> do for you:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/0*9johBVN1sAW0GRxD" /></figure><p>I encourage you to explore the other tools, but in this post, I’m only going to focus on the “<strong>Descriptive Statistics</strong>” tool.</p><p>So if you select that, then you’ll see a new window where you have to provide <strong>which columns or rows</strong> you want to analyze:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/0*FprJvS3RmZZyFUkz" /></figure><p>Since I want to analyze the prices of the Big Macs, I’m gonna have to use the column that has all the <strong>prices in the USD currency</strong>, which is <strong>column F</strong> in this dataset. So, select the <strong>first cell</strong> in column F and do <strong>Ctrl+Shift+Down</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/0*LrUyyQ1r5AdoEGFB" /></figure><p>Also, remember to leave the “<strong>Grouped By</strong>” option as “<strong>Columns</strong>”, NOT “Rows”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/0*uXbp68luUobbhucI" /></figure><p>And because the first cell is part of our input range, you have to <strong>check</strong> the “Labels in First Row” option:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/0*T95K8Sc6IOCKfeig" /></figure><p>Then, make sure that the “<strong>Summary Statistics</strong>” option is selected because that’s the <strong>type of output</strong> Excel will give you:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/0*CClg6Be_cJsmLHOD" /></figure><p>If you want, you can choose <strong>where</strong> you want the descriptive stats to be located. You can either <strong>specify the range of cells</strong> or you can just create it in a <strong>new worksheet</strong>, which I’m gonna do.</p><p>So, I’ll just call the new worksheet “<strong>Big Mac Prices Stats</strong>” and click on “OK”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/0*mwkJoh-GO75M-Erx" /></figure><h3>Analyzing “Data Analysis”</h3><p>And that’s really all it is! Once you do that, you’ll see a new worksheet with the descriptive statistics on the <strong>Big Mac prices column</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/0*P7tfnDFak3EHdNQW" /></figure><p>If you want to see me <strong>analyze this output</strong>, then make sure to check out my <strong>full video</strong> over here:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F508jcQMqYvI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D508jcQMqYvI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F508jcQMqYvI%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/799a0fe81661ed65882edb2e539fc8c7/href">https://medium.com/media/799a0fe81661ed65882edb2e539fc8c7/href</a></iframe><p>I hope to see you there, and thank you for reading all the way here!</p><p><em>Originally published at </em><a href="https://dylans0ng.github.io/2023/09/02/fastest-way-to-show-descriptive-stats.html"><em>https://dylans0ng.github.io</em></a><em> on September 2, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb8b28e302fc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-and-beyond/fastest-way-to-show-descriptive-statistics-in-excel-cb8b28e302fc">Fastest Way to Show Descriptive Statistics in Excel</a> was originally published in <a href="https://medium.com/data-and-beyond">Data And Beyond</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3 Simple Steps to Perform Linear Regression in Excel]]></title>
            <link>https://medium.com/data-and-beyond/3-simple-steps-to-perform-linear-regression-in-excel-a26188ead0d1?source=rss-61f0fa50e3f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/a26188ead0d1</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[excel]]></category>
            <category><![CDATA[statistics]]></category>
            <dc:creator><![CDATA[Dylan Song]]></dc:creator>
            <pubDate>Thu, 24 Aug 2023 00:00:01 GMT</pubDate>
            <atom:updated>2023-08-24T21:27:58.555Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/733/0*ZMVN446tOVTVY_gg" /><figcaption>This is what the final scatterplot will look like!</figcaption></figure><h3>Table of Contents</h3><p>· <a href="#b137">Introduction</a><br>· <a href="#5038">The Dataset</a><br>· <a href="#69c4">Step 1: Come Up with Your Statistical Question</a><br>· <a href="#e614">Step 2: Selecting the 2 Columns of Interest in Excel</a><br>· <a href="#9b97">Step 3: Create the Scatterplot</a><br>· <a href="#96af">Want to See More?</a></p><h3>Introduction</h3><p>In this blog post, I’ll show you <strong>3 simple steps</strong> to create a linear regression model in Excel. Linear regression is important because it can tell you <strong>important trends</strong> between two or more variables in the data. So, let’s get started!</p><h3>The Dataset</h3><p>The Kaggle dataset I’ll use in this post shows all the <strong>sale prices for the houses in the King County area</strong> (or the Seattle area). Here’s the download link, if you want to follow along: <a href="https://www.kaggle.com/datasets/harlfoxem/housesalesprediction">https://www.kaggle.com/datasets/harlfoxem/housesalesprediction</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*s2PwHRNq2vk0Z7yn" /><figcaption>Photo by <a href="https://unsplash.com/@thommilkovic">Thom Milkovic</a> on <a href="https://unsplash.com/">Unsplash</a></figcaption></figure><h3>Step 1: Come Up with Your Statistical Question</h3><p>Before we create the model, we need to know what variables we’re interested in. For this post, my question is going to be “<strong>What is the relationship between the square feet in the living room and the price?</strong>”</p><p>So, my variables are going to be the <strong>square feet</strong> and the <strong>price</strong>. You can choose your own variables, but you need to make sure that they’re <strong>continuous variables</strong>, or else you’re gonna run into a problem.</p><p>Now, we need to know what our <strong>independent</strong>, which is on the x-axis, and our <strong>dependent</strong>, which is on the y-axis, variables are. In this example, it makes sense to have the <strong>house price as the dependent variable</strong> because we’re assuming that the number of square feet in the house is going to <strong>affect</strong> what the price is.</p><p>In the next step, we’re going to hop over onto Excel.</p><h3>Step 2: Selecting the 2 Columns of Interest in Excel</h3><p>First, you have to select the <strong>second cell</strong> in the column that has all the square feets and then do <strong>Ctrl+Shift+Down</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/425/0*7sGj2zuGU46nbvDv" /></figure><p>Then, hold the <strong>Ctrl</strong> key and click on the second cell in the price column and do <strong>Ctrl+Shift+Down</strong> again:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/0*CHwWYARN_02IWKW5" /></figure><h3>Step 3: Create the Scatterplot</h3><p>Now, go to “<strong>Insert</strong>” and click on this button over here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RF0LrvEKn6ogIbsx" /></figure><p>But, there’s actually a problem:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/0*1fKlbTgp2hfSQ2On" /></figure><p>You can see that all the prices are on the <strong>x-axis</strong>, which is NOT what we want.</p><p>So to fix this, you have to right-click on the graph and click “<strong>Select Data</strong>”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*XcOe49O9xVQC7Dfu" /></figure><p>This is going to open a new window that looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/0*4Mx9v0AUhsPaXOn4" /></figure><p>From here, click on “<strong>Edit</strong>”. This is going to open another window:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/0*66o77uHWO4lpFHjE" /></figure><p>In the “<strong>Series X values</strong>” box, get rid of everything inside and starting from the 2nd cell, highlight all the values in the <strong>square feet</strong> column. In the “<strong>Series Y values</strong>” box, do the same thing but this time, highlight all the values in the <strong>price</strong> column.</p><p>So, the boxes should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/312/0*5T3VBmQ7efWYGF7o" /></figure><p>Now, the scatterplot looks a lot better now, with the <strong>square feet</strong> on the x-axis and the <strong>prices</strong> on the y-axis:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/0*7TLRBXu6B7aexZ1E" /></figure><h3>Want to See More?</h3><p>If you want to see me create a <strong>regression line</strong> over this scatterplot and <strong>analyze</strong> what the model tells us, check out my full video!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FcIyV81ZF0YE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DcIyV81ZF0YE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FcIyV81ZF0YE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8353d54c855eafda07eeeb92996e48b2/href">https://medium.com/media/8353d54c855eafda07eeeb92996e48b2/href</a></iframe><p>I hope to see you over there!</p><p><em>Originally published at </em><a href="https://dylans0ng.github.io/2023/08/24/three-simple-steps-to-perform-linear-regression-in-excel.html"><em>https://dylans0ng.github.io</em></a><em> on August 24, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a26188ead0d1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-and-beyond/3-simple-steps-to-perform-linear-regression-in-excel-a26188ead0d1">3 Simple Steps to Perform Linear Regression in Excel</a> was originally published in <a href="https://medium.com/data-and-beyond">Data And Beyond</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3 Simple Types of Visuals in Python]]></title>
            <link>https://medium.com/data-and-beyond/3-simple-types-of-visuals-in-python-a32415ab9647?source=rss-61f0fa50e3f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/a32415ab9647</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Dylan Song]]></dc:creator>
            <pubDate>Wed, 16 Aug 2023 00:00:43 GMT</pubDate>
            <atom:updated>2023-08-17T06:22:52.030Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Urb_oW_Enm6eqm0E" /><figcaption>Photo by <a href="https://unsplash.com/@goumbik">Lukas Blazek</a> on <a href="https://unsplash.com/">Unsplash</a></figcaption></figure><h3>Table of Contents</h3><p>· <a href="#ff44">Introduction</a><br>· <a href="#6cfa">The Dataset</a><br>· <a href="#a350">Importing the Libraries and Dataset in Python</a><br>· <a href="#fce6">Countplot</a><br>· <a href="#7686">2 More Visuals!</a></p><h3>Introduction</h3><p>It’s much easier to gain insights by <strong>looking at visuals</strong>, rather than looking at rows and columns of data. So, in this post, I’ll share 3 visuals that you can make <strong>using the Seaborn library</strong>, which is provided by Python.</p><h3>The Dataset</h3><p>As a demonstration, I’ll be using a dataset on all the <strong>pro tennis matches in 2022</strong>. Here’s the link, if you want to follow along: <a href="https://github.com/JeffSackmann/tennis_atp/blob/master/atp_matches_2022.csv">https://github.com/JeffSackmann/tennis_atp/blob/master/atp_matches_2022.csv</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uT1YSQmk64WQmYkf" /><figcaption>Photo by <a href="https://unsplash.com/@arnok">Moises Alex</a> on <a href="https://unsplash.com/">Unsplash</a></figcaption></figure><h3>Importing the Libraries and Dataset in Python</h3><p>In the first cell of our Jupyter notebook, we’re going to import <strong>3 libraries</strong>: Pandas, Seaborn, and Matplotlib.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/436/0*_3QL8NoLRtwHAcbE" /></figure><p>Pandas will allow us to <strong>load our tennis dataset</strong>, and Matplotlib is needed since <strong>Seaborn is built on top of it</strong>.</p><p>To load the dataset with Pandas, we say this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/0*lFOTE7ZuWZKPYWn8" /></figure><p>By running this line of code, we’ve created a Pandas dataframe called “<strong>df</strong>”. The <strong>.read_csv</strong> method takes in the file name of the dataset, and it’ll be different for you depending on <strong>where you have saved it on your local machine</strong>.</p><p>Now, we are ready to create visuals from our dataframe, and it’s quite simple!</p><h3>Countplot</h3><p>The first visual I’ll make is a <strong>countplot</strong>. This is basically a simple bar chart that counts the number of <strong>unique values in a categorical variable</strong>.</p><p>We’re gonna use one of the methods from Seaborn called <strong>.countplot</strong>. Here’s what it looks like in Python:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/0*ZGCK_sOfpXN7tnet" /></figure><p>The <strong>second line of code</strong> creates the countplot. The first argument inside the .countplot method is <strong>the dataframe</strong>, which was “df”. In the second argument, you must provide <strong>what column you want to see be counted</strong>, which was “surface”.</p><p>The third line of code basically <strong>sets a title to the graph</strong> called “Number of Tournaments by Surface”, using the <strong>.title</strong> method provided by Matplotlib.</p><p>The first line of code <strong>changes the color theme</strong> of the graph. In this case, I used the “<strong>darkgrid</strong>” style. It’s completely <strong>optional</strong>, and it’s up to you whether you want to include it or not.</p><p>Here’s what the countplot looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/0*KLL9bIryMxySMh7j" /></figure><p>It’s a very simple visual, but just by glancing at it for 1 second, you can already see that <strong>hard courts were the most common surface</strong> in tennis tournaments in 2022.</p><h3>2 More Visuals!</h3><p>If you want to know how to create the last 2 types of visuals (<strong>a scatterplot and a boxplot</strong>), then make sure to check out the video below. I’ve provided <strong>timestamps</strong> in the description so you can skip around the video. Feel free to let me know if there are any questions that you have!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FsPxQQya92dE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DsPxQQya92dE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FsPxQQya92dE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/e639cb6502c75195957d44333bfef365/href">https://medium.com/media/e639cb6502c75195957d44333bfef365/href</a></iframe><p><em>Originally published at </em><a href="https://dylans0ng.github.io/2023/08/16/three-simple-visuals-in-python.html"><em>https://dylans0ng.github.io</em></a><em> on August 16, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a32415ab9647" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-and-beyond/3-simple-types-of-visuals-in-python-a32415ab9647">3 Simple Types of Visuals in Python</a> was originally published in <a href="https://medium.com/data-and-beyond">Data And Beyond</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Clean Up your MESSY MAPS in Python]]></title>
            <link>https://medium.com/data-and-beyond/clean-up-your-messy-maps-in-python-4346d24b69e4?source=rss-61f0fa50e3f3------2</link>
            <guid isPermaLink="false">https://medium.com/p/4346d24b69e4</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[matplotlib]]></category>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Dylan Song]]></dc:creator>
            <pubDate>Thu, 03 Aug 2023 00:00:20 GMT</pubDate>
            <atom:updated>2023-08-05T18:33:22.699Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*54FBJLE1lYoI6CSN" /><figcaption>There’s too many columns!</figcaption></figure><h3>Table of Contents</h3><p>· <a href="#3f2c">Introduction</a><br>· <a href="#06f2">Specifying Certain Columns</a><br>· <a href="#764b">Displaying the Updated Map</a><br>· <a href="#f647">Renaming the Columns</a><br>· <a href="#7d7c">Displaying the Updated Map WITH THE RENAMED COLUMNS</a><br>· <a href="#e08d">Video Explanation</a></p><h3>Introduction</h3><p>In the map above, there are <strong>too many columns showing up</strong> when I hover over one of the polygons. In this article, you’ll learn how to <strong>remove the columns that you don’t want</strong> and <strong>keep the ones that you do want</strong> in the dataframe.</p><p>This is a <strong>part 2</strong> article; if you haven’t already, check out my <a href="https://medium.com/data-and-beyond/how-to-create-interactive-maps-in-python-983e01979201">part 1</a> article, where I show you step-by-step how to create the map!</p><h3>Specifying Certain Columns</h3><p>Let’s say that I want to only see <strong>3 of the columns</strong> when I hover over the polygons: “community”, “Pop2014”, “Property_C”. To do this, I can do this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/0*_P3cHHOn762gTIeV" /></figure><p>I’m keeping the “<strong>geometry</strong>” column because <strong>I need the coordinates</strong> to be able to create a map from the data.</p><p>This will get a dataframe called “<strong>file</strong>” that only shows the columns that we want:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/0*BqQVy2vDynXZ55--" /></figure><h3>Displaying the Updated Map</h3><p>Now we can display the map again on the <strong>property crime rates in Chicago</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/0*sBIFFyoEGtJO8di1" /></figure><p>And if I hover over the polygon, it’s a lot cleaner:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/0*qJZom7dfZ4fOvxAw" /></figure><h3>Renaming the Columns</h3><p>However, <strong>there’s still a problem</strong>.</p><p>If you haven’t looked at the dataset description, you might not know what “Pop2014” or “Property_C” means. I’m going to <strong>change the column names</strong> so that they make more sense to everyone.</p><p>Here’s the code for this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YnduIBw5z_jkrXDB" /></figure><p>Inside the <strong>.rename</strong> method, you can see that I passed in a <strong>dictionary</strong>. Each key in the dictionary represents <strong>the ORIGINAL column name</strong>, and each value represents <strong>the NEW column name</strong> for its corresponding key.</p><p>So, <strong>in this example</strong>, I change “community” to “Neighborhood”; “Pop2014” to “Population in 2014”; and “Property_C” to “Property Crime”.</p><p>Here’s what the dataframe should look like now:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/0*w5dj1YqW1nKW-y19" /></figure><h3>Displaying the Updated Map WITH THE RENAMED COLUMNS</h3><p>Now, let’s display the map with our <strong>updated dataframe</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/0*rkA-IrQlTtMPc2AY" /></figure><p>Notice that I said “Property Crime” instead of “Property_C”. This is because we changed the column, so <strong>“Property_C” no longer exists</strong>. If you tried to pass in “Property_C”, you <strong>would get an error</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/0*PW4bkk69MpYIq1JL" /></figure><p>Looking at the map, all of our 3 columns are changed and that looks really clean!</p><h3>Video Explanation</h3><p>Thank you for making it all the way here! I’ve made a YouTube tutorial that <strong>goes over the steps</strong> that I talked about in this post. Feel free to check that out here:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FWzRM6l5tBVI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DWzRM6l5tBVI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FWzRM6l5tBVI%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/59afa2022b0f01b7a8e84d530d24ef6a/href">https://medium.com/media/59afa2022b0f01b7a8e84d530d24ef6a/href</a></iframe><p><em>Originally published at </em><a href="https://dylans0ng.github.io/2023/08/03/clean-messy-maps.html"><em>https://dylans0ng.github.io</em></a><em> on August 3, 2023.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4346d24b69e4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-and-beyond/clean-up-your-messy-maps-in-python-4346d24b69e4">Clean Up your MESSY MAPS in Python</a> was originally published in <a href="https://medium.com/data-and-beyond">Data And Beyond</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>