BUG: Calling to_html with float_format strips all trailing zeros if an integer string is returned from the formatter
- [x] I have checked that this issue has not already been reported.

- [x] I have confirmed this bug exists on the latest version of pandas.

- [ ] (optional) I have confirmed this bug exists on the master branch of pandas.

---

#### Code Sample, a copy-pastable example

```python
import pandas as pd
df = pd.DataFrame(data={'x': [1000.0, 'test']}) # Column dtype must be object
df.to_html(float_format=lambda x: '{:,.0f}'.format(x))
```

#### Output:

```html
'<table border="1" class="dataframe">\n  <thead>\n    <tr style="text-align: right;">\n      <th></th>\n      <th>x</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>1,</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>test</td>\n    </tr>\n  </tbody>\n</table>'
```

#### Problem description

This caused by the rstrip in pandas.io.formats.format._trim_zeros_single_float()

#### Expected Output

```html
'<table border="1" class="dataframe">\n  <thead>\n    <tr style="text-align: right;">\n      <th></th>\n      <th>x</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>1,000</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>test</td>\n    </tr>\n  </tbody>\n</table>'
```

#### Output of ``pd.show_versions()``

<details>

```
INSTALLED VERSIONS
------------------
pandas           : 1.2.2
numpy            : 1.20.1
pytz             : 2021.1
dateutil         : 2.8.1
pip              : 20.3.3
setuptools       : 51.3.3
```

</details>
