I have an issue while saving the data_frame to excel. On Jupyter notebook it shows the cell color along with "%" sign. but when we save to excel using any engine it does not save the "%" symbol, it only saves the color.

0   0.000000    0.00%   0.000000    0.00%   0.000000    0.00%   0.000000
1   -0.000884   100.00% 0.137259    90.00%  1.378786    17.00%  1.669904
2   -0.025000   100.00% 0.697000    16.00%  0.834000    -44.00% 0.578000

Here is the df.style I am using(Getting all the month column and formatting it from the sheet).

sales = [col for col in new_df.columns if 'month' in col]
df.style.applymap(lambda x: "background-color: red" if x>0 else "background-color: lime", subset=sales).format('{:,.2f}%', subset=sales)

At the beginning we can not add the % in sheet since it will convert the float to str which we are not looking for.

What I am getting now is not with %:

Current Value

Expected output is like this:

Expected Output

0

There are 0 answers