I have some DataFrame:
fake_data = {'columnA': ['XYVA', 'YXYX', 'XAVY', 'XAVY', 'XAAY', 'AXAV', 'AXYV', 'AXXV', 'AXXV', 'AXXV', 'AXXV']}
df = pd.DataFrame(fake_data, columns = ['columnA'])
df
I can color the cells by frequency of each character at each position (Count the frequency of characters at a position in a string in a Pandas DataFrame column):
new_data = df.columnA.str.split('', n = 4, expand=True).drop(0, axis=1)
stats = new_data.apply(pd.Series.value_counts)
stats = stats.apply(lambda x: x.div(x.sum())*100).round(1).fillna(0)
stats.style.background_gradient(cmap='Greys', axis=None)
Which returns:
Now I'm trying to remove the numerical values from the cells (leaving color only) and denote these values instead with a colorbar.