Bar Chart Race of Global Brands Ranking 2000 - 2020

global-brands-1448469179.jpg

Markets have always been competitive especially with the global brands. Each year, a lot of new players join the field and the king or queen of brands can never be too safe. In this dynamic visualization, we will be featuring the ranking movement of the top 10 global brands across years 2000 to 2020.

For more information about the bar_chart_race package used, check: https://github.com/dexplo/bar_chart_race

In [1]:
import bar_chart_race as bcr
import pandas as pd
import numpy as np

import warnings
warnings.filterwarnings('ignore')

df = pd.read_csv('C:/Users/ACER/Desktop/brands_csv.csv')
df.head()
Out[1]:
Company Name Symbol Image URL 2000 2001 2002 2003 2004 2005 2006 ... 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020
0 Coca-Cola A https://cdn.worldvectorlogo.com/logos/coca-col... 72537 68945 69637 70453 67394 67525 67000 ... 71861 77839 79213 118863 78423 73102 69733 66341 65004 64400
1 Microsoft C https://cdn.worldvectorlogo.com/logos/microsof... 70196 65068 64091 65174 61372 59941 56926 ... 59087 57853 59546 107439 67670 72795 79999 92715 95023 100200
2 IBM F https://cdn.worldvectorlogo.com/logos/ibm.svg 53183 52752 51188 51767 53791 53376 56201 ... 69905 75532 78808 81563 65095 52500 46829 42972 41290 40002
3 GE J https://cdn.worldvectorlogo.com/logos/general-... 39048 42396 41311 42340 44111 46996 48907 ... 42808 43682 46947 45480 42267 43130 44208 32757 32090 30156
4 Intel Y https://cdn.worldvectorlogo.com/logos/intel.svg 39048 34665 30861 31112 33499 35588 32319 ... 35217 39385 37257 34153 35415 36952 39459 43292 44009 45010

5 rows × 24 columns

In [2]:
brands = pd.DataFrame(df.T)

new_header = brands.iloc[0] #grab the first row for the header
brands.columns = new_header #set the header row as the df header
brands = brands[3:] #take the data less the header row
brands.head()
Out[2]:
Company Name Coca-Cola Microsoft IBM GE Intel Nokia Disney McDonald's Ford Marlboro ... HP Cisco American Express Gillete BMW Apple Google Samsung Amazon Facebook
2000 72537 70196 53183 39048 39048 38528 33553 27859 36368 22110 ... 0 20067 0 17358 12969 0 0 0 0 0
2001 68945 65068 52752 42396 34665 35035 32591 25289 30092 22053 ... 17983 17209 16919 15298 13858 0 0 0 0 0
2002 69637 64091 51188 41311 30861 29970 29256 26375 20403 24151 ... 16776 16222 16287 14959 14425 0 0 0 0 0
2003 70453 65174 51767 42340 31112 29440 28036 24699 17066 22183 ... 19860 15789 16833 15978 15106 0 0 0 0 0
2004 67394 61372 53791 44111 33499 24041 27113 25001 14475 22128 ... 20978 15948 17683 16723 15886 0 0 0 0 0

5 rows × 24 columns

In [3]:
brands_2 = brands.cumsum()
brands_2 = brands_2.apply(pd.to_numeric)
# brands_2.to_csv('C:/Users/ACER/Desktop/jupyter_brands2.csv')
brands_2.head()
Out[3]:
Company Name Coca-Cola Microsoft IBM GE Intel Nokia Disney McDonald's Ford Marlboro ... HP Cisco American Express Gillete BMW Apple Google Samsung Amazon Facebook
2000 72537 70196 53183 39048 39048 38528 33553 27859 36368 22110 ... 0 20067 0 17358 12969 0 0 0 0 0
2001 141482 135264 105935 81444 73713 73563 66144 53148 66460 44163 ... 17983 37276 16919 32656 26827 0 0 0 0 0
2002 211119 199355 157123 122755 104574 103533 95400 79523 86863 68314 ... 34759 53498 33206 47615 41252 0 0 0 0 0
2003 281572 264529 208890 165095 135686 132973 123436 104222 103929 90497 ... 54619 69287 50039 63593 56358 0 0 0 0 0
2004 348966 325901 262681 209206 169185 157014 150549 129223 118404 112625 ... 75597 85235 67722 80316 72244 0 0 0 0 0

5 rows × 24 columns

In [6]:
bcr.bar_chart_race(df=brands_2, 
                   n_bars=10,
                   colors='Set1', 
                   title='Ranking of Global Brands from 2000-2020', 
                   bar_size=.7,
                   bar_kwargs={'alpha': .7},
                   fig_kwargs={'figsize': (6, 3.5), 'dpi': 144},
                   filter_column_colors=False,
                   bar_textposition='inside',
                    steps_per_period=20, 
                    period_length=500, 
                    end_period_pause=0,
                   bar_texttemplate='{x:,.0f}', 
                   bar_label_font=7, 
                   tick_label_font=7, 
                   tick_template='{x:,.0f}',
                   sort='desc',
                   period_label={'x': .98, 'y': .3, 'ha': 'right', 'va': 'top'},
                   fixed_max=True)
Out[6]: