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

Class DataFrameInfo

pandas/io/formats/info.py:279–349  ·  view source on GitHub ↗

Class storing dataframe-specific info.

Source from the content-addressed store, hash-verified

277
278
279class DataFrameInfo(_BaseInfo):
280 """
281 Class storing dataframe-specific info.
282 """
283
284 def __init__(
285 self,
286 data: DataFrame,
287 memory_usage: bool | str | None = None,
288 ) -> None:
289 self.data: DataFrame = data
290 self.memory_usage = _initialize_memory_usage(memory_usage)
291
292 @property
293 def dtype_counts(self) -> Mapping[str, int]:
294 return _get_dataframe_dtype_counts(self.data)
295
296 @property
297 def dtypes(self) -> Iterable[Dtype]:
298 """
299 Dtypes.
300
301 Returns
302 -------
303 dtypes
304 Dtype of each of the DataFrame's columns.
305 """
306 return self.data.dtypes
307
308 @property
309 def ids(self) -> Index:
310 """
311 Column names.
312
313 Returns
314 -------
315 ids : Index
316 DataFrame's column names.
317 """
318 return self.data.columns
319
320 @property
321 def col_count(self) -> int:
322 """Number of columns to be summarized."""
323 return len(self.ids)
324
325 @property
326 def non_null_counts(self) -> Series:
327 """Sequence of non-null counts for all columns or column (if series)."""
328 return self.data.count()
329
330 @property
331 def memory_usage_bytes(self) -> int:
332 deep = self.memory_usage == "deep"
333 return self.data.memory_usage(index=True, deep=deep).sum()
334
335 def render(
336 self,

Callers 1

infoMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected