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
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()
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()
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()
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)