Visualize Programming Language Popularity using tiobeindexpy

Visualize Programming Language Popularity using tiobeindexpyAMRBlockedUnblockFollowFollowingMar 6Even though, most of us would be coding in one primary programming language, it is always good to keep an eye on the shift that happens in the world of programming.

TIOBE is an organization that has created an index for programming languages and tracks the change of that index, every month.

In this post, We will use tiobeindexpy Python package to visualize programming language popularity so that can serve as a small tracker for us to revisit every month.

About the package:tiobeindexpy is a Python package (available on PyPi) that gives us TIOBE Index extract from the official website.

Installation:The stable version of tiobeindexpy can be installed using pip.

pip install tiobeindexpyIf you have got Python3, Please make sure to use pip3 install tiobeindexpy to avoid any conflicts.

ObjectiveThere are three things we’d try to have achieved at the end of the exercise.

What are the top 20 popular programming languages (as of the month of Feb 2019)Who are the top 5 gainers (Feb 2018 vs Feb 2019 — Out of the ones present in current Top 20)Who are the top 5 losers (Feb 2018 vs Feb 2019 — Out of the ones present in current Top 20)Loading LibrariesAs its typical of a decent coding style, Let us start with loading the required libraries.

from tiobeindexpy import tiobeindexpy as tbpyimport seaborn as snsIt has to be noted that once the library is loaded, tiobeindexpy downloads required data from TIOBE index website.

Hence all other subsequent functions would just take that data and would not make an actual server call.

Plot Size and ThemeI’d also prefer to set up the Plot size and its theme at the start — which would make it easier if anyone wants to play with this parameters without looking deep into the code.

sns.

set(style = "whitegrid")sns.

set(rc={'figure.

figsize':(11.

7,8.

27)})The Top 20To start with, We’ll use the function top_20() from tiobeindexpy to extract the top 20 programming languages based on TIOBE Index Ratings.

top_20 = tbpy.

top_20()Before we move on to visualize the data, Let us just try to verify if the data is actually available by printing it.

top_20As you can see from the above output, It’s evident that the Python object top_20 is a Pandas dataframe and it is actually for the month of Mar 2019.

You might also notice the % symbol next to the numeric values in Ratings and Change.

1 column — which also means, these columns must be string in the extracted dataframe, hence need to be prepossessed.

Data PreprocessingIn this step, We’ll strip (remove) the % symbol from those two above mentioned columns and we’ll type cast them to floating point fields.

top_20['Ratings'] = top_20.

loc[:,'Ratings'].

apply(lambda x: float(x.

strip("%")))top_20['Change.

1'] = top_20.

loc[:,'Change.

1'].

apply(lambda x: float(x.

strip("%")))Beginning Data VisualizationAs we’ve got our data preprocessed, we’re now ready to start visualizing the programming languages rankings.

Top 20 Programming LanguagesWe can start with a very simple bar plot of the Rankings of Top 20 Languages (based on their TIOBE Index Ratings)sns.

barplot('Ratings', 'Programming Language', data = top_20).

set_title('Mar 2019 – Programming Popularity')Java, C, Python — are the top 3 languages based on TIOBE Index.

The Ratings difference between Java and Python seems humongous leaving me wondering to look into TIOBE Index methodology for clarity.

Between 2018 and 2019There’s a lot has changed in the world — especially in technology between 2018 and 2019 so let’s try to see how the difference in a year looks like:Top 5 Gainerssns.

barplot('Programming Language', 'Change.

1', data = top_20.

sort_values("Change.

1",ascending = False)[0:5]).

set_title('Mar 2018 vs 2019 – Language Popularity – Biggest Gainers from Top 20')Python has been the leader with taking the biggest leap forward followed by VB.

NET and C++.

Top 5 Loserssns.

barplot('Change.

1', 'Programming Language', data = top_20.

sort_values("Change.

1",ascending = True)[0:5]).

set_title('Mar 2018 vs 2019 – Language Popularity – Biggest Losers from Top 20')C#, PHP, Ruby — have been the leaderboard toppers in terms of the percentage of change (negative).

So far, this has given us a good monthly picture and how the popularity of programming languages are changing.

Hall of Fame — last 15 yearsLet’s abstract up and try to see what are the programming language that are Hall of Fame winners each year.

We can simply use tiobeindexpy ‘s function hall_of_fame() to extract the Hall of Fame data.

hof = tbpy.

hall_of_fame()A slightly formatted table of the above output.

hof.

style.

set_properties(**{'background-color': 'black', 'color': 'lawngreen', 'border-color': 'white'})This data shows, how time and time again, Python picks up when a new trend comes in and this way, how it has become one of the most appearing entries in the hall of fame.

SummaryIn this post, we’ve seen how to use the python packages tiobeindexpy and seaborn for visualizing programming language popularity (rankings) based on its TIOBE index.

ReferencesThe entire code used here is available as a Jupyter Notebook on GithubTIOBE Index Office Websitetiobeindexpy github repo.

. More details

Leave a Reply