Writing pandas DataFrame to Excel with different formats for different columns

I am trying to write a pandas

DataFrame

to an

.xlsx

file where different numerical columns would have different formats. For example, some would show only two decimal places, some would show none, some would be formatted as percents with a "%" symbol, etc.

I noticed that

DataFrame.to_html()

has a

formatters

parameter that allows one to do just that, mapping different formats to different columns. However, there is no similar parameter on the

DataFrame.to_excel()

method. The most we have is a

float_format

that is global to all numbers.

I have read many SO posts that are at least partly related to my question, for example: