<?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 Michael Black on Medium]]></title>
        <description><![CDATA[Stories by Michael Black on Medium]]></description>
        <link>https://medium.com/@michaelblack-2306?source=rss-119df7e847c4------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ZMFc2vdvyc_7GC3IyD_-dg.jpeg</url>
            <title>Stories by Michael Black on Medium</title>
            <link>https://medium.com/@michaelblack-2306?source=rss-119df7e847c4------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 00:00:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@michaelblack-2306/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[Proving the ‘Birthday Paradox’ with Python Data Visualization]]></title>
            <link>https://michaelblack-2306.medium.com/proving-the-birthday-paradox-with-python-and-data-visualization-2c0153e980e?source=rss-119df7e847c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c0153e980e</guid>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[funny]]></category>
            <dc:creator><![CDATA[Michael Black]]></dc:creator>
            <pubDate>Fri, 12 Nov 2021 18:17:56 GMT</pubDate>
            <atom:updated>2021-11-17T15:12:58.684Z</atom:updated>
            <content:encoded><![CDATA[<h4>Math is confusing, graphs are not</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cqXkU3A_Tb5LsnEb" /><figcaption>Photo by <a href="https://unsplash.com/@anniespratt?utm_source=medium&amp;utm_medium=referral">Annie Spratt</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Here’s a fact about me: I am a sucker for interesting math facts. I find big numbers particularly interesting, especially when they are presented as a real-world example such that the only plausible initial reaction is “<em>There’s no way that can be true…right?</em>”</p><p>The other night, while aimlessly scrolling through Twitter, I came across this video:</p><h3>big dug on Twitter: &quot;This video has completely blown my mind. I had to Google to confirm its accuracy pic.twitter.com/MCrYEvgkvm / Twitter&quot;</h3><p>This video has completely blown my mind. I had to Google to confirm its accuracy pic.twitter.com/MCrYEvgkvm</p><p>My jaw hit the floor when he said there were <strong>over 6 billion unique ways to order one suit of cards</strong>. Six BILLION!!!</p><p>Now, the rest of this article has nothing to do with this video, or factorial, or even large numbers, but I wanted to start here because 1) this video is awesome and 2) it led me down an internet rabbit hole of interesting math facts.</p><p>That rabbit hole led me to <a href="https://www.cantorsparadise.com/what-is-the-birthday-paradox-e72cc15832e1">The Birthday Paradox</a>.</p><p>The birthday paradox states simply:</p><blockquote>If there are 23 people in a room, the probability that two of them share the same birthday is roughly 50%.</blockquote><p>This number seems high, right?</p><p>I’m not going to get into the math behind it (click the linked article above for a great explanation), but the reason this seems so confusing is that we initially think about comparing <em>just</em> <em>our own birthday </em>against 22 others to find a match. This would leave us with just 22 pairs of birthdays to check.</p><p>What we actually need to do is compare <em>everybody’s birthday </em>against 22 others to find a match. Person one compares their birthday against the other 22, person two compares theirs against 21 (minus person one because they already compared theirs), person three compares against 20, and so on. At the end of all these birthday comparisons, we would have now checked 253 pairs of birthdays.</p><p>Okay, this logic makes sense. But still, as often is the case with these hard-to-believe math facts, it FEELS like it shouldn’t be true, no?</p><p>While gathering multiple groups of 23 strangers and demanding they all share their birthdays seemed like the most foolproof option, there were some logistical and ethical concerns with this route. For this reason, I decided to use Python.</p><p>I ran 250 trials where I selected 23 random numbers between 1 and 365 and checked to see if any of the 23 matched. I counted these instances as “successes” and calculated their probability against the total number of trials:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/889deec974028aee9cbdce2a15e4ddbd/href">https://medium.com/media/889deec974028aee9cbdce2a15e4ddbd/href</a></iframe><p>I dumped the results into a Pandas DataFrame and graphed it:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5833583aca67904e2ceebda426f179fc/href">https://medium.com/media/5833583aca67904e2ceebda426f179fc/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatapane.com%2Fu%2Fwmblack23%2Freports%2FMA1pv9k%2Fthe-birthday-paradox-23-250%2Fembed%2F&amp;display_name=Datapane&amp;url=https%3A%2F%2Fdatapane.com%2Fu%2Fwmblack23%2Freports%2FMA1pv9k%2Fthe-birthday-paradox-23-250%2F&amp;image=https%3A%2F%2Fdatapane.com%2Fstatic%2Fpython_report_illustration.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=datapane" width="960" height="700" frameborder="0" scrolling="no"><a href="https://medium.com/media/60f1a83e6aeeab5e1d461a692d403ef0/href">https://medium.com/media/60f1a83e6aeeab5e1d461a692d403ef0/href</a></iframe><p>As you can see, while there are some fluctuations at the beginning, by the 150 trial mark the probability of two people sharing a birthday out of just 23 has settled in right around 50%. If we let it run for say, 10,000 more trials, the graph would completely flatten out right at 50%.</p><p>The Birthday Paradox also states that if 59 people are in one room then the probability that two of them share a birthday is virtually guaranteed at 99%.</p><p>Let’s see?</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatapane.com%2Fu%2Fwmblack23%2Freports%2Fd7dXYM7%2Fthe-birthday-paradox-57-250%2Fembed%2F&amp;display_name=Datapane&amp;url=https%3A%2F%2Fdatapane.com%2Fu%2Fwmblack23%2Freports%2Fd7dXYM7%2Fthe-birthday-paradox-57-250%2F&amp;image=https%3A%2F%2Fdatapane.com%2Fstatic%2Fpython_report_illustration.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=datapane" width="960" height="700" frameborder="0" scrolling="no"><a href="https://medium.com/media/afe5d1a9d908138004b7daec28fb863a/href">https://medium.com/media/afe5d1a9d908138004b7daec28fb863a/href</a></iframe><p>Using the 59 person parameter, the graph essentially becomes a straight line. In fact, by using the hover tool you can see that it isn’t until the 80th trial that we get our first instance of not having a matching birthday.</p><p>The probability chart for the Birthday Paradox is shown with the code and graph below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/efdd4f497cab525a588cf6a3ad8605fb/href">https://medium.com/media/efdd4f497cab525a588cf6a3ad8605fb/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatapane.com%2Fu%2Fwmblack23%2Freports%2FVkGyv03%2Fbirthday-paradox-probability-line-graph%2Fembed%2F&amp;display_name=Datapane&amp;url=https%3A%2F%2Fdatapane.com%2Fu%2Fwmblack23%2Freports%2FVkGyv03%2Fbirthday-paradox-probability-line-graph%2F&amp;image=https%3A%2F%2Fdatapane.com%2Fstatic%2Fpython_report_illustration.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=datapane" width="960" height="700" frameborder="0" scrolling="no"><a href="https://medium.com/media/9dcd71eb892feb5a5d44c50350094a44/href">https://medium.com/media/9dcd71eb892feb5a5d44c50350094a44/href</a></iframe><p>Right at x=23, the line crosses the probability threshold of 0.50. By x=59, the curve has flattened out as it gets ever closer to 1.0; it remains this way until x=366, at which point the probability becomes 1.0.</p><p>Well, there you have it.</p><p>Next time you’re in a room with 22 other people, you can be <em>pretty certain </em>that at least two of them are birthday buddies. If another 39 people enter this hypothetical gathering, you can stand up and proclaim with near statistical certainty that at least two of them were birthed on the same date.</p><p>Will anybody care? Will this information ever be useful to you ever again?</p><p>Probably not.</p><p>But you’re welcome.</p><p>Michael Black</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c0153e980e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scraping S̶o̶c̶c̶e̶r̶ Football Fixtures with Beautiful Soup and Python]]></title>
            <link>https://medium.com/geekculture/scraping-s%CC%B6o%CC%B6c%CC%B6c%CC%B6e%CC%B6r%CC%B6-football-fixtures-with-beautiful-soup-and-python-81f47f5098d3?source=rss-119df7e847c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/81f47f5098d3</guid>
            <category><![CDATA[sports]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[soccer]]></category>
            <category><![CDATA[web-scraping]]></category>
            <dc:creator><![CDATA[Michael Black]]></dc:creator>
            <pubDate>Sat, 11 Sep 2021 15:22:37 GMT</pubDate>
            <atom:updated>2021-09-15T02:39:07.630Z</atom:updated>
            <content:encoded><![CDATA[<p>View fixtures and live scores from any league, on any day, straight from the terminal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wr-gtJCN4jZdraYL" /><figcaption>Photo by <a href="https://unsplash.com/@jesusance?utm_source=medium&amp;utm_medium=referral">Thomas Serer</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If you’re like me, you love football. And I’m not talking about the version where feet aren’t used and the ball isn’t a ball; I’m talking about <em>football </em>— the world’s most beloved game, and, if nothing else, the more aptly named of the two sports.</p><p>If you love football as I do, we have likely felt a similar frustration that comes with being a fan of the beautiful game: <strong>It is time-consuming and challenging to keep up with the schedules and results of five major domestic leagues + the UEFA Champions League when you’re a regular person with responsibilities and a poor memory</strong>.</p><p>Recently, after googling “La Liga fixtures” followed by “Premier League fixtures” followed by “Serie A fixtures” etc., for the thousandth time, I realized something needed to change.</p><blockquote>What I wanted was a way to view the matchups of only the leagues I care about, on any given day, with minimal effort, straight from my terminal.</blockquote><p>I decided to harness the powers of Python and Beautiful Soup and give it my best shot.</p><blockquote>I will only be showing the web-scraping code for this article. I will add a link to my GitHub repository at the bottom of the article so that you can view the rest of the program in full and download it for your own personal use.</blockquote><h4>Step 1: Finding a Website</h4><p>The first step to scraping information from the web is finding a site that has the information you are looking for (duh). This isn’t always as easy as it may seem, and there are some key differences in the types of sites you’ll encounter and how easily they can be scraped.</p><ul><li><a href="https://www.hughesandco.ca/blog/the-difference-between-dynamic-and-static-websites#:~:text=In%20general%2C%20dynamic%20means%20capable,method%20they%20use%20to%20display."><strong>Static Websites </strong>are displayed in a web browser exactly as they are stored. The web pages contain fixed content coded in HTML and stay the same for every viewer of the site.</a></li><li><a href="https://www.hughesandco.ca/blog/the-difference-between-dynamic-and-static-websites#:~:text=In%20general%2C%20dynamic%20means%20capable,method%20they%20use%20to%20display."><strong>Dynamic Websites</strong>, on the other hand, contain information that changes, depending on factors such as the viewer of the site, the time of day, time zone, and the native language of the country of the viewer. Dynamic websites are interactive.</a></li></ul><p>The short of it is that <em>static websites are a bit simpler to scrape.</em> As the title of the article states, I used Beautiful Soup to do my scraping; BS works great for static webpages, but not so much for dynamic.</p><p>After a bit of searching and comparing, the site I settled on was<a href="https://www.bbc.com/sport/football/scores-fixtures"> bbc.com/sport/football/scores-fixtures:</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*ngd00uTMkkTauuP_Hbl7VA.gif" /><figcaption>Scores and fixtures for Saturday, September 11, 2021</figcaption></figure><p>The page is simple yet thorough and contains all of the information needed for my project. The page changes only slightly for live and finished games, as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*QBbO8WVfLrJ44rsDmiipVQ.png" /><figcaption>Live scores and finished games on the webpage</figcaption></figure><p>I am unable to click on team names or matchups to gather more information, which tells me the page isn’t interactive. Also, although I am accessing the page from the US, the game times are still being shown in British Summer Time (UK timezone). These are both indicators that the webpage is static, as discussed above.</p><p>Now that I’ve got a site, it’s time to scrape.</p><h4>Step 2: Import Packages and Connect to the Website</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5917ae73a64e9c2f44451fdb30533207/href">https://medium.com/media/5917ae73a64e9c2f44451fdb30533207/href</a></iframe><p>I can call <em>html_content:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kGxoj7DHlewdtmKVueBcTA.png" /></figure><p>This returns all of the HTML content from the webpage as a long string. Below, I run the variable through BeautifulSoup:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a2de6a370b1ca6ce493af4fae09e3af8/href">https://medium.com/media/a2de6a370b1ca6ce493af4fae09e3af8/href</a></iframe><p>Which produces the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ib3Tnd6iUt-G48cWc7t-ew.png" /></figure><p>This has transformed <em>html_content</em> into a BeautifulSoup object, <em>soup</em>, which represents the content as a nested data structure. I can now easily search the object for HTML tags and specific data, which is shown in Step 4.</p><h4>Step 3: Inspect the Page</h4><p>Page inspection is essentially just locating the HTML identifiers for the information you need. Thinking about my project, I need identifiers for the following:</p><ul><li>League names</li><li>Home and Away team names</li><li>Game times</li><li>Home and Away scores</li><li>Minute-of-game (for live games) and ‘FT’ (Full Time) for completed games</li></ul><p>To inspect any of those, you simply highlight them on the page, right-click, then select “Inspect”. Doing this to “Premier League” (league name) will give the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-eH6HBE_zfTtWUpWk6Amjw.png" /><figcaption>Inspecting ‘Premier League’ on the webpage</figcaption></figure><p>I can see that league names on this page have <strong>h3</strong> (header) tags and <strong>class=“gel-minion sp-c-match-list-heading”</strong>. You’ll need to know both!</p><p>Repeat this step for all of the information that needs inspecting.</p><h4>Step 4: soup.find_all()</h4><p>This step is pretty simple: combine all of the tags and classes from above into two separate lists, and search for them within the <em>soup</em> variable using the find_all() function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/78d8ccaf6b49fb02c60346f7b203be97/href">https://medium.com/media/78d8ccaf6b49fb02c60346f7b203be97/href</a></iframe><p>The 7 items that I inspected after “Premier League” all had the HTML <em>span </em>tag.</p><ul><li>The list “tags” contains all of the tags from the items that I inspected. In this case, I only had <em>h3 </em>and <em>span.</em></li><li>The list “classes” contains the 8 class strings from the HTML I inspected.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ec6272cf861a489104a95acb7c8981ab/href">https://medium.com/media/ec6272cf861a489104a95acb7c8981ab/href</a></iframe><p>We are telling <em>scraper </em>to inspect the variable <em>soup</em> by looking at all <em>h3</em> elements with the listed classes and all <em>span</em> elements with the listed classes.</p><p>We can call scraper:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*in5p5pBPHPKbDaLsYqK8yg.png" /><figcaption>Scraping Premier League fixtures (09/11/2021)</figcaption></figure><p>Let’s compare the first seven elements in <em>scraper</em> with the webpage:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7myBOpAB_08GGXYJajCR0Q.png" /></figure><p>There is still a lot of data cleaning, organizing, and formatting left to do, but at this point, we have successfully scraped the site for everything we need.</p><h4>Step 5+: Python!</h4><p>As I noted at the top, from here on is just Python. Rather than show all the code I used to build the rest of the program, <a href="https://github.com/wmblack23/Live-Soccer-Scraper">I am linking my GitHub repository here</a>. Feel free to check it out — <strong>and</strong> <strong>if you’re a football fan, download the program and use it on your own computer!</strong></p><h4>Final Product</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*c61ZvIpGj7h4r1PkGSdHDw.gif" /><figcaption>Web scraping program for fixtures on Saturday, September 11, 2021</figcaption></figure><p>You now know the basics of static vs. dynamic websites, how to inspect a webpage, and Beautiful Soup! This brief introduction should be enough to have you comfortably using Python and Beautiful Soup to scrape the web for your own personal projects.</p><p>I hope you found this helpful.</p><p>Michael Black</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81f47f5098d3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/scraping-s%CC%B6o%CC%B6c%CC%B6c%CC%B6e%CC%B6r%CC%B6-football-fixtures-with-beautiful-soup-and-python-81f47f5098d3">Scraping S̶o̶c̶c̶e̶r̶ Football Fixtures with Beautiful Soup and Python</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating and Embedding Interactive Scatter Plots using Plotly Express]]></title>
            <link>https://medium.com/geekculture/using-plotly-express-to-create-interactive-graphs-of-the-greatest-scorers-in-nba-playoff-history-3f0cc085d933?source=rss-119df7e847c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f0cc085d933</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[plotly]]></category>
            <category><![CDATA[nba]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Michael Black]]></dc:creator>
            <pubDate>Tue, 15 Jun 2021 05:15:10 GMT</pubDate>
            <atom:updated>2021-06-15T14:03:08.740Z</atom:updated>
            <content:encoded><![CDATA[<p>Going step-by-step using Plotly Express, Python, and Pandas to plot the NBA’s All-Time Leading Playoff Scorers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1ls3EdFnCqnnQD6iSm-Hfg.jpeg" /></figure><p>Creating visually appealing graphs is an important part of conveying your message when working with data. Graphs with easily distinguishable points/lines, helpful legends, and interactive features like zooming and hovering (to name just two) are much more informative and user-friendly than those without.</p><p>While there are a few ways to do this, I have found one that I find really simple and powerful: <a href="https://plotly.com/python/plotly-express/">Plotly Express</a>. <strong>In this article, I will create (and embed) interactive graphs of the NBA’s All-Time Leading Playoff Scorers using Plotly, Python, and Pandas.</strong></p><p>Let’s look at a couple of quick examples.</p><h4>Step 1: Retrieving the Data</h4><p>I am not going to show the code I used to call the API and create my DataFrame in this article, <strong>but I highly encourage you to </strong><a href="https://github.com/wmblack23/NBA-Playoff-Leading-Scorers-Interactive-Jupyter-ScatterPlot/blob/main/Playoff%20Points%20Leaders.ipynb"><strong>visit my GitHub repository</strong></a><strong> and view the notebook yourself</strong>. It is commented out and easy to follow.</p><blockquote>You can also <a href="https://github.com/wmblack23/NBA-Playoff-Leading-Scorers-Interactive-Jupyter-ScatterPlot/raw/main/Playoff%20DataFrame.xlsx">download the Excel file</a> containing all of the NBA Playoff data I use in this article and then follow along with the code provided step-by-step.</blockquote><h4>Step 2: Loading and Organizing Data</h4><p>Importing our libraries:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d096c3dde708b9fdc59e9d5e1365a8c2/href">https://medium.com/media/d096c3dde708b9fdc59e9d5e1365a8c2/href</a></iframe><p>Loading our Excel file into a Pandas DataFrame:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/edb1e39679eabf8dbfb318543f8cda8d/href">https://medium.com/media/edb1e39679eabf8dbfb318543f8cda8d/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatapane.com%2Fu%2Fwmblack23%2Freports%2Fnba-playoff-points-data%2Fembed%2F&amp;display_name=Datapane&amp;url=https%3A%2F%2Fdatapane.com%2Fu%2Fwmblack23%2Freports%2Fnba-playoff-points-data%2F&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fdatapane-files-prod%2Fdp%2Fthumbnails%2F2b195de3-5d5b-44fd-89c2-d12ba90274fd.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=datapane" width="960" height="700" frameborder="0" scrolling="no"><a href="https://medium.com/media/cd39e136181397dd6b3ae1f3130c749b/href">https://medium.com/media/cd39e136181397dd6b3ae1f3130c749b/href</a></iframe><p>I also want to add a fourth column — ‘Playoff PPG’ (Points Per Game):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca65d5b7ceea82feb591cbd9672e2ca1/href">https://medium.com/media/ca65d5b7ceea82feb591cbd9672e2ca1/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatapane.com%2Fu%2Fwmblack23%2Freports%2Fnba-playoffs-points-data%2Fembed%2F&amp;display_name=Datapane&amp;url=https%3A%2F%2Fdatapane.com%2Fu%2Fwmblack23%2Freports%2Fnba-playoffs-points-data%2F&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fdatapane-files-prod%2Fdp%2Fthumbnails%2F93a3d6f8-29bf-44e1-aa67-9309cc4499fc.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=datapane" width="960" height="700" frameborder="0" scrolling="no"><a href="https://medium.com/media/14ceecb82b96878478d0aff714d68a75/href">https://medium.com/media/14ceecb82b96878478d0aff714d68a75/href</a></iframe><h4>Step 3: Time to Graph</h4><p>Use Plotly to create a scatter plot:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bae972b1b0d189b5b6b40a24f838e412/href">https://medium.com/media/bae972b1b0d189b5b6b40a24f838e412/href</a></iframe><ul><li><strong>data_frame</strong> — set equal to my DataFrame: ‘playoff_data_DF’</li><li><strong>x</strong> — values for x-axis: ‘Playoff Games Played’. Column in DataFrame.</li><li><strong>y</strong> — value for the y-axis: ‘Playoff Points Scored’. Column in DataFrame.</li><li><strong>title</strong> — setting a title for the plot.</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatapane.com%2Fu%2Fwmblack23%2Freports%2Fnba-playoff-scoring-all-players%2Fembed%2F&amp;display_name=Datapane&amp;url=https%3A%2F%2Fdatapane.com%2Fu%2Fwmblack23%2Freports%2Fnba-playoff-scoring-all-players%2F&amp;image=https%3A%2F%2Fdatapane.com%2Fstatic%2Fpython_report_illustration.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=datapane" width="960" height="700" frameborder="0" scrolling="no"><a href="https://medium.com/media/de0d9f23ed13119994dcda04e46c0754/href">https://medium.com/media/de0d9f23ed13119994dcda04e46c0754/href</a></iframe><p>Not bad!</p><p>By hovering over any point on the graph, we can see the number of playoff points and games corresponding to the point. This is a useful feature — but would be much more useful if we could also see the NAME of the player when we hover over a point. *Hint, hint.*</p><p>We can also click and drag (creating a rectangle) on any point of the graph to zoom in. <em>This is especially helpful on a graph such as this with so many points clustered together.</em></p><h4><strong>Adding Visual Features</strong></h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e40ada688d8f5e26ead753c99644e640/href">https://medium.com/media/e40ada688d8f5e26ead753c99644e640/href</a></iframe><ul><li><strong>Size</strong> — we specify the column ‘Playoff Points Scored’ to tell our graph to make the points larger for players with higher totals of playoff points and smaller for those with less.</li><li><strong>Template</strong> — Plotly has a handful of template options to design your plot (included in GitHub repo). I prefer a white background.</li><li><strong>Color</strong> — We specify ‘Playoff PPG’ for our color variable. This means we will give similar colors to points that have similar ‘Playoff PPG’ values.</li><li><strong>Size_max</strong> — the maximum size of any point on the plot.</li><li><strong>Hover_name</strong> — now, when we hover over a point we will see the ‘Player Name’ as the first value.</li><li><strong>Hover_data</strong> — including ‘Playoff PPG’ in our hover_data so that we can see it along with ‘Player Name’ and our x and y-values.</li><li>I chose ‘Jet’ as my <strong>color scale</strong>. <a href="https://plotly.com/python/builtin-colorscales/">More here</a>.</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatapane.com%2Fu%2Fwmblack23%2Freports%2Fnba-playoff-scoring-adding-features%2Fembed%2F&amp;display_name=Datapane&amp;url=https%3A%2F%2Fdatapane.com%2Fu%2Fwmblack23%2Freports%2Fnba-playoff-scoring-adding-features%2F&amp;image=https%3A%2F%2Fdatapane.com%2Fstatic%2Fpython_report_illustration.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=datapane" width="960" height="700" frameborder="0" scrolling="no"><a href="https://medium.com/media/c32fdc4b2b1f424131b02e2c70765aba/href">https://medium.com/media/c32fdc4b2b1f424131b02e2c70765aba/href</a></iframe><blockquote>By setting color equal to ‘PPG’ and size equal to ‘Total Points’, we can make easy observations without even needing to use our zoom and hover features.</blockquote><h4><strong>Top 200 — Additional Added Features</strong></h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/02d41a82de862aced1954c3b56de0eb2/href">https://medium.com/media/02d41a82de862aced1954c3b56de0eb2/href</a></iframe><ul><li><strong>Trendline</strong> — ‘ols’: Ordinary Least Squares regression line. This allows us to make further observations about our data. Which players are scoring above, below, or at the expected amount of points given the number of playoff games they have played? Try hovering over the regression line as well!</li><li><strong>Add_hline</strong> — adding a horizontal line representing the median number of playoff points scored by the Top 200 scorers.</li><li><strong>Add_vline</strong> — adding a vertical line representing the median number of playoff games played by the Top 200 scores.</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatapane.com%2Fu%2Fwmblack23%2Freports%2Ftop200-regression-and-more%2Fembed%2F&amp;display_name=Datapane&amp;url=https%3A%2F%2Fdatapane.com%2Fu%2Fwmblack23%2Freports%2Ftop200-regression-and-more%2F&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fdatapane-files-prod%2Fdp%2Fthumbnails%2F1a1e4b81-9ed0-4f4d-8577-59a65326cc05.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=datapane" width="960" height="700" frameborder="0" scrolling="no"><a href="https://medium.com/media/b4e922fbec0dbdbb8eb47e5d1294108c/href">https://medium.com/media/b4e922fbec0dbdbb8eb47e5d1294108c/href</a></iframe><p>The two ‘add_line’ features, like the trendline above, allow us to make additional observations about the players:</p><ul><li>Dennis Rodman, in the bottom-right quadrant, has played in more playoff games than the average player on this list but only averaged 6.4 PPG, so he comes in well below the median line for points scored.</li><li>Likewise, in the upper-left, Allen Iverson has scored more than the average amount of points compared to the Top 200 (29.73 PPG) while playing a significantly less-than-average number of games, so he comes in at the left of the median line for games played.</li></ul><p>Those in the top-right quadrant, players who appeared and produced at a higher-than-average rate compared to the rest of the Top 200, are all current or future top-tier NBA greats; <strong>especially those who also fall above the regression line.</strong></p><p>In fact, if we want to take a closer look at who makes up this super-elite group of NBA Playoff scorers, we can do so with the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fafeeecdb1321c2c96e3c6b475c9a914/href">https://medium.com/media/fafeeecdb1321c2c96e3c6b475c9a914/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatapane.com%2Fu%2Fwmblack23%2Freports%2Fgreatest-performers-nba-playoff-history%2Fembed%2F&amp;display_name=Datapane&amp;url=https%3A%2F%2Fdatapane.com%2Fu%2Fwmblack23%2Freports%2Fgreatest-performers-nba-playoff-history%2F&amp;image=https%3A%2F%2Fdatapane.com%2Fstatic%2Fpython_report_illustration.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=datapane" width="960" height="700" frameborder="0" scrolling="no"><a href="https://medium.com/media/b8e83db477655d54d6692f9d2a8ad40b/href">https://medium.com/media/b8e83db477655d54d6692f9d2a8ad40b/href</a></iframe><p>These are the players who <strong>played in more playoff games</strong> (&gt; 118) and <strong>scored more playoff points</strong> (&gt; 1959) than the averages of the Top 200 playoff scorers ever AND <strong>outscored the prediction of our OLS trendline</strong>.</p><p>If you are interested in learning how to embed your tables and visualizations using <a href="https://datapane.com/">DataPane</a> as I have done here, I would encourage you to <a href="https://towardsdatascience.com/how-to-embed-interactive-charts-on-your-medium-articles-and-website-6987f7b28472">check out this helpful article</a>.</p><p>Embedding with DataPane is a really handy and easy-to-use feature that helps make your data more accessible to your readers.</p><p>Thank you for reading!</p><p>Check out the GitHub link at the top of the article for more.</p><p><strong>Michael Black</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f0cc085d933" width="1" height="1" alt=""><hr><p><a href="https://medium.com/geekculture/using-plotly-express-to-create-interactive-graphs-of-the-greatest-scorers-in-nba-playoff-history-3f0cc085d933">Creating and Embedding Interactive Scatter Plots using Plotly Express</a> was originally published in <a href="https://medium.com/geekculture">Geek Culture</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Examining the Ever-Rising Cost of Competing in the English Premier League]]></title>
            <link>https://michaelblack-2306.medium.com/using-python-and-pandas-to-examine-the-ever-rising-cost-of-competing-in-the-english-premier-league-5cb8f6ed68ea?source=rss-119df7e847c4------2</link>
            <guid isPermaLink="false">https://medium.com/p/5cb8f6ed68ea</guid>
            <category><![CDATA[premier-league]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[sports]]></category>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Michael Black]]></dc:creator>
            <pubDate>Tue, 08 Jun 2021 03:20:17 GMT</pubDate>
            <atom:updated>2021-09-15T02:34:23.008Z</atom:updated>
            <content:encoded><![CDATA[<h4>Using Python and Pandas to look at the growth of annual club wage bills in England’s top-flight since 2000-’01</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ror0RGdXcEY5BVy0" /><figcaption>Photo by <a href="https://unsplash.com/@nathanjayrog?utm_source=medium&amp;utm_medium=referral">Nathan Rogers</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>As somebody who grew up watching only American sports leagues, I found it surprising upon becoming a fan of the English Premier League that the idea of a salary cap did not exist. Now, as a seasoned fan of European soccer, I have come to love many aspects of their league structure: relegation, playing for multiple cups in a single season, and the way that clubs are so closely linked to the communities in which they reside.</p><p>With that being said, the top-heavy nature of European soccer still does not fully sit right with me. <strong>This article examines team wage bills in the English Premier League from the 2000-’01 season until the 2019-’20 season and looks at how team spending has disproportionately grown to favor the large clubs, leaving the rest behind.</strong></p><p><em>I am dropping a link here to my GitHub repository if you would like to view the code. It is commented out and explained step-by-step: </em><a href="https://github.com/wmblack23/Money-Spent-versus-Matches-Won-in-the-English-Premier-League"><em>github.com/wmblack23/Money-Spent-versus-Matches-Won</em></a><em>.</em></p><h4>Average Premier League Wage Bill (2000-’01 to 2019-’20)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8wtSlfDBDtoNIYWVj2uzCg.png" /><figcaption><strong>Annual average wages have risen from £27 million in 2000-’01 to £160 million in 2019-’20.</strong></figcaption></figure><p>S<strong>pending is increasing, fast. </strong>In 2019, Premier League clubs spent over 6x more on average on their rosters than they did in 2000.* <em>(Adjustment for inflation at the end of the article.)</em></p><p>Is this true for all teams?</p><h4>Difference in Spending Between ‘Top 4’ and ‘Bottom 3&#39; Clubs</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_ODc3fiGgDkVxhk_0F3RCw.png" /><figcaption><strong>In the 2000-’01 season, Top 4 (Champions League) teams spent roughly £28 million more than Bottom 3 (relegated) teams. In 2019-’20, that same figure has ballooned to £217 million.</strong></figcaption></figure><p>There has been a mad spending spree in the English top-flight since the turn of the century, and <strong>teams at the bottom are being left in the dust. </strong>In the 2019-’20 season, Premier League teams who qualified for the Champions League spent £217 million more than those who were relegated.</p><blockquote>One interesting note regarding 2015: the difference in spending that season was such an outlier in large part because the champions (Leicester City) spent just £80 million while 20th place and relegated Aston Villa spent nearly £95 million.</blockquote><h4>Cost of the Champions League</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uwuC6NRDTXYd-w4IeQA-2w.png" /><figcaption><strong>In order to qualify for the Champions League in 2019-’20, clubs need to spend nearly £300 million.</strong></figcaption></figure><p>VS.</p><h4>Cost of Relegation</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VuiXH6ngFbFcJhMjbIHjyQ.png" /><figcaption><strong>The average cost of relegation in 2019-’20 is nearly £100 million.</strong></figcaption></figure><p><strong>Top 4 clubs spend ~7x</strong> more today than they spent 20 years ago, compared to <strong>~5.5x more for relegated teams</strong>.</p><p>The gap between the groups continues to widen, making the Champions League aspirations of a smaller club less and less realistic with each passing season.</p><p><strong>The cost to compete is rising, while only a select few teams are able to rise with it.</strong></p><p>Having said all of this, I am, like everyone else, a shameless fan of a large club. I love watching the best teams and the best players compete, and as much as I frown upon the direction this league is heading, I am a willing participant in its capitalistic spiral.</p><p>Let’s take a look at the spending habits of the ‘Big 6’ since 2000-’01:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u4ESNGLLWY3f5Lh61rHi2A.png" /><figcaption><strong>You can see the exact point, around 2008, when Manchester City acquired new ownership and began their torrid spending spree.</strong></figcaption></figure><p>Manchester City, a long-time languisher in England’s lower divisions, is a great case study in the role that spending money plays in club success. They have become a domestic juggernaut simply because they’re able and willing to spend more than everybody else.</p><p>Looking at the chart below, pay attention to the same x-value: ‘2008’. There is a similarly incredible jump in City’s points-per-season at the exact same time that they began their insane run of spending:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LzFOQNQZlgruyK4m5iAMgQ.png" /><figcaption><strong>Manchester City’s points-per-season has exploded since new ownership took over in 2008.</strong></figcaption></figure><p>We should love the story of a relegated-club-turned-dynasty. But the way it happened for City, born not out of commitment or hard work but rather the influx of unlimited oil money, is antithetical to the very idea of competition.</p><p><strong>If being the best team is simply a matter of having the most resources, then we have lost much of what makes this sport so great.</strong></p><p>Now that we have a solid understanding of the increase in league-wide spending, the gap between the Top 4 and Bottom 3, and the idea that money can buy success, we need to answer the final question: <strong>is there a level playing field in the English Premier League?</strong></p><p>The very basic understanding of competition is that all participants should have a fair and equal shot of winning.</p><p>Is this the case in England’s top-flight?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mSAyY6TGgXBoiQHf2H79Hg.png" /><figcaption><strong>Big 6 clubs have accounted for 75/80 (94%) of the Top 4 finishes since 2000-’01!</strong></figcaption></figure><p>In the 20 years of data we studied, 40 clubs (not counting the Big 6) played a total of 281 campaigns, and <strong>only 5 times did one of those clubs finish within the top 4.</strong></p><blockquote>A non-Big 6 club playing in the Premier League from 2000–2020 only had a <strong>1.8% likelihood to finish within the Top 4.</strong></blockquote><h4>Pay-to-Play</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-kkU1dea87eBgQ2IKgOyAg.png" /><figcaption><strong>Big 6 teams have spent £1.1 billion more than the other 40 Premier League participants combined in 162 fewer campaigns.</strong></figcaption></figure><p>Since 2000, the Big 6 represents just 30% (119/400) of all Premier League campaigns. Despite this, they account for:</p><ul><li>94% of the top 4 finishes</li><li>52% of ALL money spent</li></ul><p><strong>There is NOT a level playing field in the English Premier League.</strong></p><p>Maybe this is just the way many fans like it, and it’s never easy to disrupt the status quo, but a league that offers just a 2% chance of real success (finishing in the top 4 and qualify for the Champions League) to 70% of its participants does not feel like a sustainable model, and it certainly doesn’t feel like the best we can do.</p><p>Thanks for reading!</p><p><em>Michael Black</em></p><p>— — — — — — — — — — — — — — — — — — — — — — — — — —</p><h4>Inflation Adjustment</h4><p>The British Pound £ has an annual inflation rate of about 1.85% since the year 2000:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EsJfZ9y2SPf_4kVBX773jw.png" /><figcaption><strong>Factoring annual inflation into the Average Premier League Wage Bills chart.</strong></figcaption></figure><p>When factoring this into our Average Premier League Wage Bill (2000-’01 to 2019-’20) chart from the top of the article, we see that <strong>average spending has increased ~4.5x since 2000</strong>, not the 6x that we originally stated.</p><p>While each of our graphs would show a bit less growth if we factored them all for inflation, the general pattern of a rapid and disproportionate increase in spending power favoring the top 5–7 clubs would still be reflected.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5cb8f6ed68ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>