Returns a string representation of the footer.
(self)
| 2303 | return category_strs |
| 2304 | |
| 2305 | def _get_repr_footer(self) -> str: |
| 2306 | """ |
| 2307 | Returns a string representation of the footer. |
| 2308 | """ |
| 2309 | category_strs = self._repr_categories() |
| 2310 | dtype = str(self.categories.dtype) |
| 2311 | levheader = f"Categories ({len(self.categories)}, {dtype}): " |
| 2312 | width, _ = get_terminal_size() |
| 2313 | max_width = get_option("display.width") or width |
| 2314 | if console.in_ipython_frontend(): |
| 2315 | # 0 = no breaks |
| 2316 | max_width = 0 |
| 2317 | levstring = "" |
| 2318 | start = True |
| 2319 | cur_col_len = len(levheader) # header |
| 2320 | sep_len, sep = (3, " < ") if self.ordered else (2, ", ") |
| 2321 | linesep = f"{sep.rstrip()}\n" # remove whitespace |
| 2322 | for val in category_strs: |
| 2323 | if max_width != 0 and cur_col_len + sep_len + len(val) > max_width: |
| 2324 | levstring += linesep + (" " * (len(levheader) + 1)) |
| 2325 | cur_col_len = len(levheader) + 1 # header + a whitespace |
| 2326 | elif not start: |
| 2327 | levstring += sep |
| 2328 | cur_col_len += len(val) |
| 2329 | levstring += val |
| 2330 | start = False |
| 2331 | # replace to simple save space by |
| 2332 | return f"{levheader}[{levstring.replace(' < ... < ', ' ... ')}]" |
| 2333 | |
| 2334 | def _get_values_repr(self) -> str: |
| 2335 | from pandas.io.formats import format as fmt |
no test coverage detected