<?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" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ bokeh - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ bokeh - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Sun, 31 May 2026 14:27:00 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/bokeh/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ Rolling Stone’s 500 Greatest Albums Visualized Using Pandas and Bokeh ]]>
                </title>
                <description>
                    <![CDATA[ By Gautham Koorma In 2003, Rolling Stones Magazine polled musicians, producers, and industry executives about their favorite albums. The result was a special issue titled “The 500 Greatest Albums of All Time.” The list — which they revised in 2012 — ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/visualising-rolling-stones-500-greatest-songs-using-bokeh-78ebc0eaff3f/</link>
                <guid isPermaLink="false">66c36494da3c91501890b9de</guid>
                
                    <category>
                        <![CDATA[ bokeh ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Data Science ]]>
                    </category>
                
                    <category>
                        <![CDATA[ data visualization ]]>
                    </category>
                
                    <category>
                        <![CDATA[ music ]]>
                    </category>
                
                    <category>
                        <![CDATA[ pandas ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Fri, 13 Jan 2017 05:42:23 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*XWotllyqakSjGMCVnSavuA.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Gautham Koorma</p>
<p>In 2003, Rolling Stones Magazine polled musicians, producers, and industry executives about their favorite albums. The result was a special issue titled “The 500 Greatest Albums of All Time.”</p>
<p>The list — which they revised in 2012 — mainly features American and British music from the 1960s and the 1970s.</p>
<p>As an ardent music fan and an aspiring music producer, I listen to a wide variety of genres. The Rolling Stones list served as an introduction to rock music for me back in the day.</p>
<p>One day I while browsing through <a target="_blank" href="https://www.kaggle.com/notgibs/500-greatest-albums-of-all-time-rolling-stone">Kaggle</a> to pick up a simple data set and test my newly acquired data visualization skills, I stumbled upon the list uploaded as a CSV dataset. I decided to get my hands dirty by using <a target="_blank" href="http://pandas.pydata.org/pandas-docs/stable/">pandas</a> to explore the data and <a target="_blank" href="http://bokeh.pydata.org/en/latest/">bokeh</a> to visualize the results.</p>
<p>Bokeh is a Python library for interactive visualization. It features a powerful interface that supports high-level charting, intermediate-level plotting, and lower-level modeling.</p>
<p>The complete code I used for reading, refining, exploring, and visualizing the data can be found on my <a target="_blank" href="https://github.com/itzzthad/kaggle-exercises/tree/master/rollingstones-dataset">GitHub</a> page, and also in this <a target="_blank" href="https://www.kaggle.com/thadx89/d/notgibs/500-greatest-albums-of-all-time-rolling-stone/exploring-and-visualizing-using-bokeh/notebook">notebook</a> submitted on Kaggle.</p>
<p>This post will describe the approaches I took, complete with my visualizations and the insight I gained from building them.</p>
<h3 id="heading-getting-and-structuring-the-data">Getting and Structuring the Data</h3>
<p>Getting the data was simple, since it was in a 500 x 6 excel spreadsheet. All I had to do was read it into a pandas data frame directly by using the <code>[read_excel()](http://pandas.pydata.org/pandas-docs/stable/api.html#input-output)</code> function.</p>
<p>The data frame had 500 rows, one for each album listing the Chart Number, Year, Album, Artist, Genre, and Subgenre. The Genre and Subgenre columns had multiple comma separated values in a string, so I had to split the string at the first comma and keep just the first value in new columns as the most relevant categorization of the album’s Genre and Subgenre.</p>
<p>The master data frame became 500 x 8 after the Genres_Refined and Subgenres_Refined columns were added.</p>
<p>I used a Python 3.5.2 kernel (Anaconda 4.2.0 distribution) on a Jupyter notebook.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/khm0JasV4brSldxU3gjE6K5SOtKhDzohZ2ww" alt="Image" width="800" height="480" loading="lazy">
<em><strong>My master data frame</strong></em></p>
<h3 id="heading-exploring-the-data-and-gaining-insights">Exploring the Data and Gaining Insights</h3>
<p>I adopted the split-apply-combine strategy using pandas inbuilt <code>[groupby()](http://pandas.pydata.org/pandas-docs/stable/groupby.html)</code> function in most cases and the reshaping strategy using pandas inbuilt <code>[pivot_table()](http://pandas.pydata.org/pandas-docs/stable/reshaping.html)</code> function for a single case. I fed the resulting data frames into bokeh charts and figures.</p>
<p>Here are the questions I posed and their resulting visualizations.</p>
<h3 id="heading-the-top-10-artists-who-have-the-most-albums-on-the-list"><strong>The top-10 artists who have the most albums on the list</strong></h3>
<p>To get the top 10 artists, I used <code>groupby()</code> on the artists column, took a count, and sorted the resulting data frame to get the top 10 artists having the most number of albums.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/697-DyzoYiJllMswVuVsR6wkvSoq9k5bTOHc" alt="Image" width="284" height="411" loading="lazy"></p>
<p>To visualize the results, I used the a figure object from the <a target="_blank" href="http://bokeh.pydata.org/en/0.10.0/docs/reference/plotting.html">bokeh.plotting</a> library and drew black circles using the <code>circle()</code> method.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/PylJBnNPv0AK2rODbr1O8gXYqjrkPqePtLuo" alt="Image" width="800" height="800" loading="lazy">
<em><strong>Top 10 artists</strong></em></p>
<p>Clearly, the Beatles, Bob Dylan, and the Rolling Stones topped the list with 10 albums apiece.</p>
<h3 id="heading-year-wise-count-of-the-number-of-albums-in-the-list">Year-wise count of the number of albums in the list</h3>
<p>To get this, I used <code>groupby()</code> on the year column and took a count following which I sorted the data by year and plotted the resulting data frame using a line chart from <a target="_blank" href="http://bokeh.pydata.org/en/latest/docs/reference/charts.html">bokeh.charts</a>.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/dlpHy4jDWktcph9vPOYoRhYAmcMRfGXgFb1g" alt="Image" width="800" height="800" loading="lazy">
<em><strong>Year wise distribution of albums</strong></em></p>
<p>Maximum number of albums in the list were released in 1970. Albums released in the late 1960s and early 1970s were also found abundantly. The final spike is found in the early 1990s accounting for the outbreak of Pop, R&amp;B, and Hip-Hop music.</p>
<h3 id="heading-top-genres-and-subgenres">Top Genres and Subgenres</h3>
<p>To identify the top genres and the subgenres within them, I reshaped the data using the pandas _pivot<em>table()</em> function in which I set the index as the Genre_Refined and Subgenre_Refine columns, and set the <code>aggfunc</code> parameter to count.</p>
<p>After taking a subset of the data frame using a condition that there should be more than 5 albums in a subgenre, I fed the data frame to a bokeh <a target="_blank" href="http://bokeh.pydata.org/en/latest/docs/gallery/donut_chart.html">donut</a> chart and set the <a target="_blank" href="http://bokeh.pydata.org/en/0.10.0/docs/gallery/palettes.html">palette</a> to Purples9.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/Bo7OxIwip41CctBBhbhm9FgikYMtYrLO-NUb" alt="Image" width="800" height="800" loading="lazy">
<em><strong>Top Genres and Subgenres</strong></em></p>
<p>Rock and its subgenres cover about 80% of the selection. Hip-Hop, R&amp;B, Soul, Country, and Electronic music albums covered the remaining 20%.</p>
<h3 id="heading-songs-in-each-genre-by-year">Songs in each Genre by year</h3>
<p>To get this data, I did a <code>groupby()</code> on Year and Genre_Refined, took the count, sorted the values by Year, and fed the resulting data frame to a bokeh <a target="_blank" href="http://bokeh.pydata.org/en/latest/docs/gallery/heatmap_chart.html">heatmap</a>. This time I used the Reds9 palette.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/jUj2CP8YlL3FhiLw3NjhCUrCIoNMgSDA8GJp" alt="Image" width="800" height="400" loading="lazy">
<em><strong>Heatmap of Songs in Each Genre by Year</strong></em></p>
<p>Rock music albums from the late 60s and the 70s are clearly the most numerous. Funk, Soul, and Jazz music albums reduced in numbers over the years, paving the way for Hip-Hop and Electronic albums.</p>
<h3 id="heading-subgenres-of-rock-over-the-years">Subgenres of Rock Over the Years</h3>
<p>To get this data, I did a <code>groupby()</code> on the Year, Genre_Refined, and Subgenre_Refined, took a count, and subset the data frame to include just Rock in the Genre_Refined column. I then fed the resulting data frame to a bokeh heatmap.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1Cwu9afCgikiHgf0bAO5lshGlUzkJ9zpwQ32" alt="Image" width="800" height="800" loading="lazy">
<em><strong>Subgenres of rock over the years</strong></em></p>
<p>The initial few years were dominated by Rock &amp; Roll, while Blues Rock and Pop Rock slowly increased in number by the mid 1960s. By the mid 1970s, Alternative Rock started coming into the picture, followed by Indie Rock in the mid 1980s.</p>
<h3 id="heading-a-summary-of-the-top-10-albums">A summary of the Top 10 albums</h3>
<p>Finally, I summarized the top 10 albums in the list after grouping it by artist.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/tDiNCoIgsFIvLKhMCEccJE6ZouFidw0ombFI" alt="Image" width="800" height="632" loading="lazy">
<em><strong>Top 10 Albums grouped by Artist</strong></em></p>
<p>The final results are not really surprising. The Rolling Stone Magazine list mostly contains songs from from Rock and its various subgenres, with a few outliers in the form of Hip-Hop, R&amp;B, Soul, Country, and Electronic music albums.</p>
<p>If you’re like me and like to occasionally reconnect with the music of the Beatles, Bob Dylan, Rolling Stones, and the other pioneers of Rock and Roll during the 60s and 70s, I suggest you give these top albums a listen, then explore from there.</p>
<p>If you’re curious, you can read the full list of albums <a target="_blank" href="http://www.rollingstone.com/music/lists/500-greatest-albums-of-all-time-20120531">here</a>.</p>
<p>I’m a technology consultant, data science enthusiast, and aspiring music producer. If you have writing opportunities or are interested in getting in touch for work, feel free to write to me at contact at gautham dot biz.</p>
<p>If you liked this article, please hit the recommend button and share it with your friends.</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
