Search code examples
pythonheatmapcrosstabexponential

Stop exponential values in table


When building a heatmap in seaborn, is there a way to stop exponential values appearing: ''' count_table = pd.crosstab(df["Exited"], df["NumOfProducts"]) sns.heatmap(count_table, annot=True, center=0.5) '''

The output gets values like 3.345e+03

Thank you.


Solution

  • I'm assuming you are referring to the format of the numbers in the cells. You can use the fmt argument to control the formatting, for example

    sns.heatmap(count_table, annot=True, fmt=".1f")