I have floats and I'm interested in just the decimal places of them because the integer part is not important (and always will be the same in my problem).
I have to use string formatting because the number will be displayed on seaborn plots.
I'm using
'0.2f'
to display just two decimal, however I don't know how to remove the integer part.
Example:
I want to show
.25 instead of 0.25
Details:
The implementation must work to format the values in seaborn.heatmap:
sns.heatmap(table, annot = True, fmt = '.2f')
but I want to display just the decimals as described above.
.apply, to format all of the columns in the dataframe, which can then be passed toannot=, withfmt=''.f'{v:.2f}'[-3:]where.2frounds to two decimal places, and[-3:]slices the last three characters (e.g..xx)..apply, but given the size of a dataframe passed tosns.heatmap, this will not impact performance.dfannot