I am having an issue with the following dataframe:
import pandas as pd
import plotly.figure_factory as ff
df = pd.DataFrame(index=[2017, 2018, 2019, 2020, 2021, 'Wallet'],
data={'Product A':[62.46, 118.77, 88.42, 37.35, 66.30, 42.44],
'Product B':[0, 0, 0, 0.32, 0, 0],
'Product C':[0, 0, 0, 0.43, 0, 0],
'Product D':[7.32, 15.15, 18.05, 7.47, 11.81, 6.43]})
fig = ff.create_annotated_heatmap(
z = df.values,
x = df.columns.tolist(),
y = df.index.tolist(),
colorscale='greens'
)
fig.show()
This results in following heatmap:
When I am using all columns only from data which are string - itβs ok; when I am using all columns from data which are int - itβs ok; when the data is mixed than such issue occurs. I tried to change 2017 to str(2017) but it doesnβt help. If you change βWalletβ to 2022 - everything looks perfectly.