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

Method _repr_2d

pandas/core/arrays/base.py:2086–2101  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2084 return f"Length: {len(self)}, dtype: {self.dtype}"
2085
2086 def _repr_2d(self) -> str:
2087 from pandas.io.formats.printing import format_object_summary
2088
2089 # the short repr has no trailing newline, while the truncated
2090 # repr does. So we include a newline in our template, and strip
2091 # any trailing newlines from format_object_summary
2092 lines = [
2093 format_object_summary(x, self._formatter(), indent_for_name=False).rstrip(
2094 ", \n"
2095 )
2096 for x in self
2097 ]
2098 data = ",\n".join(lines)
2099 class_name = f"<{type(self).__name__}>"
2100 footer = self._get_repr_footer()
2101 return f"{class_name}\n[\n{data}\n]\n{footer}"
2102
2103 def _formatter(self, boxed: bool = False) -> Callable[[Any], str | None]:
2104 """

Callers 1

__repr__Method · 0.95

Calls 5

_formatterMethod · 0.95
_get_repr_footerMethod · 0.95
format_object_summaryFunction · 0.90
rstripMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected