MCPcopy
hub / github.com/pandas-dev/pandas / justify

Method justify

pandas/io/formats/printing.py:528–537  ·  view source on GitHub ↗

Perform ljust, center, rjust against string or list-like

(self, texts: Any, max_len: int, mode: str = "right")

Source from the content-addressed store, hash-verified

526 return len(text)
527
528 def justify(self, texts: Any, max_len: int, mode: str = "right") -> list[str]:
529 """
530 Perform ljust, center, rjust against string or list-like
531 """
532 if mode == "left":
533 return [x.ljust(max_len) for x in texts]
534 elif mode == "center":
535 return [x.center(max_len) for x in texts]
536 else:
537 return [x.rjust(max_len) for x in texts]
538
539 def adjoin(self, space: int, *lists: Any, **kwargs: Any) -> str:
540 return adjoin(space, *lists, strlen=self.len, justfunc=self.justify, **kwargs)

Callers 5

to_stringMethod · 0.45
_make_fixed_widthFunction · 0.45
justMethod · 0.45

Calls 3

ljustMethod · 0.80
centerMethod · 0.80
rjustMethod · 0.80

Tested by 1

justMethod · 0.36