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

Method _format_data

pandas/core/indexes/base.py:1462–1485  ·  view source on GitHub ↗

Return the formatted data as a unicode string.

(self, name=None)

Source from the content-addressed store, hash-verified

1460
1461 @final
1462 def _format_data(self, name=None) -> str_t:
1463 """
1464 Return the formatted data as a unicode string.
1465 """
1466 # do we want to justify (only do so for non-objects)
1467 is_justify = True
1468
1469 if self.inferred_type == "string":
1470 is_justify = False
1471 elif isinstance(self.dtype, CategoricalDtype):
1472 self = cast("CategoricalIndex", self)
1473 if is_string_dtype(self.categories.dtype):
1474 is_justify = False
1475 elif isinstance(self, ABCRangeIndex):
1476 # We will do the relevant formatting via attrs
1477 return ""
1478
1479 return format_object_summary(
1480 self,
1481 self._formatter_func,
1482 is_justify=is_justify,
1483 name=name,
1484 line_break_each_value=self._is_multi,
1485 )
1486
1487 def _format_attrs(self) -> list[tuple[str_t, str_t | int | bool | None]]:
1488 """

Callers 2

__repr__Method · 0.95
__repr__Method · 0.80

Calls 2

is_string_dtypeFunction · 0.90
format_object_summaryFunction · 0.90

Tested by

no test coverage detected