Return a html representation for a particular DataFrame. Mainly for IPython notebook.
(self)
| 1201 | return self.to_string(**repr_params) |
| 1202 | |
| 1203 | def _repr_html_(self) -> str | None: |
| 1204 | """ |
| 1205 | Return a html representation for a particular DataFrame. |
| 1206 | |
| 1207 | Mainly for IPython notebook. |
| 1208 | """ |
| 1209 | if self._info_repr(): |
| 1210 | buf = StringIO() |
| 1211 | self.info(buf=buf) |
| 1212 | # need to escape the <class>, should be the first line. |
| 1213 | val = buf.getvalue().replace("<", r"<", 1) |
| 1214 | val = val.replace(">", r">", 1) |
| 1215 | return f"<pre>{val}</pre>" |
| 1216 | |
| 1217 | if get_option("display.notebook_repr_html"): |
| 1218 | max_rows = get_option("display.max_rows") |
| 1219 | min_rows = get_option("display.min_rows") |
| 1220 | max_cols = get_option("display.max_columns") |
| 1221 | show_dimensions = get_option("display.show_dimensions") |
| 1222 | show_floats = get_option("display.float_format") |
| 1223 | |
| 1224 | formatter = fmt.DataFrameFormatter( |
| 1225 | self, |
| 1226 | columns=None, |
| 1227 | col_space=None, |
| 1228 | na_rep="NaN", |
| 1229 | formatters=None, |
| 1230 | float_format=show_floats, |
| 1231 | sparsify=None, |
| 1232 | justify=None, |
| 1233 | index_names=True, |
| 1234 | header=True, |
| 1235 | index=True, |
| 1236 | bold_rows=True, |
| 1237 | escape=True, |
| 1238 | max_rows=max_rows, |
| 1239 | min_rows=min_rows, |
| 1240 | max_cols=max_cols, |
| 1241 | show_dimensions=show_dimensions, |
| 1242 | decimal=".", |
| 1243 | ) |
| 1244 | return fmt.DataFrameRenderer(formatter).to_html(notebook=True) |
| 1245 | else: |
| 1246 | return None |
| 1247 | |
| 1248 | @overload |
| 1249 | def to_string( |