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

Method _ensure_frame

pandas/plotting/_matplotlib/core.py:667–680  ·  view source on GitHub ↗
(self, data)

Source from the content-addressed store, hash-verified

665
666 @final
667 def _ensure_frame(self, data) -> DataFrame:
668 if isinstance(data, ABCSeries):
669 label = self.label
670 if label is None and data.name is None:
671 label = ""
672 if label is None:
673 # We'll end up with columns of [0] instead of [None]
674 data = data.to_frame()
675 else:
676 data = data.to_frame(name=label)
677 elif self._kind in ("hist", "box"):
678 cols = self.columns if self.by is None else self.columns + self.by
679 data = data.loc[:, cols]
680 return data
681
682 @final
683 def _compute_plot_data(self) -> None:

Callers 1

__init__Method · 0.95

Calls 1

to_frameMethod · 0.45

Tested by

no test coverage detected