Skip to content

Commit 8f26d87

Browse files
authored
CLN: cleanup DataFrameInfo (#36641)
1 parent 0ecff23 commit 8f26d87

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

pandas/io/formats/info.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ def _get_mem_usage(self, deep: bool) -> int:
111111
mem_usage : int
112112
Object's total memory usage in bytes.
113113
"""
114-
pass
115114

116115
@abstractmethod
117116
def _get_ids_and_dtypes(self) -> Tuple["Index", "Series"]:
@@ -125,7 +124,6 @@ def _get_ids_and_dtypes(self) -> Tuple["Index", "Series"]:
125124
dtypes : Series
126125
Dtype of each of the DataFrame's columns.
127126
"""
128-
pass
129127

130128
@abstractmethod
131129
def _verbose_repr(
@@ -145,7 +143,6 @@ def _verbose_repr(
145143
show_counts : bool
146144
If True, count of non-NA cells for each column will be appended to `lines`.
147145
"""
148-
pass
149146

150147
@abstractmethod
151148
def _non_verbose_repr(self, lines: List[str], ids: "Index") -> None:
@@ -159,7 +156,6 @@ def _non_verbose_repr(self, lines: List[str], ids: "Index") -> None:
159156
ids : Index
160157
The DataFrame's column names.
161158
"""
162-
pass
163159

164160
def info(self) -> None:
165161
"""
@@ -296,7 +292,6 @@ def _verbose_repr(
296292
len_id = len(pprint_thing(id_head))
297293
space_num = max(max_id, len_id) + col_space
298294

299-
header = _put_str(id_head, space_num) + _put_str(column_head, space)
300295
if show_counts:
301296
counts = self.data.count()
302297
if col_count != len(counts): # pragma: no cover
@@ -319,17 +314,26 @@ def _verbose_repr(
319314
len_dtype = len(dtype_header)
320315
max_dtypes = max(len(pprint_thing(k)) for k in dtypes)
321316
space_dtype = max(len_dtype, max_dtypes)
322-
header += _put_str(count_header, space_count) + _put_str(
323-
dtype_header, space_dtype
324-
)
325317

318+
header = "".join(
319+
[
320+
_put_str(id_head, space_num),
321+
_put_str(column_head, space),
322+
_put_str(count_header, space_count),
323+
_put_str(dtype_header, space_dtype),
324+
]
325+
)
326326
lines.append(header)
327-
lines.append(
328-
_put_str("-" * len_id, space_num)
329-
+ _put_str("-" * len_column, space)
330-
+ _put_str("-" * len_count, space_count)
331-
+ _put_str("-" * len_dtype, space_dtype)
327+
328+
top_separator = "".join(
329+
[
330+
_put_str("-" * len_id, space_num),
331+
_put_str("-" * len_column, space),
332+
_put_str("-" * len_count, space_count),
333+
_put_str("-" * len_dtype, space_dtype),
334+
]
332335
)
336+
lines.append(top_separator)
333337

334338
for i, col in enumerate(ids):
335339
dtype = dtypes[i]

0 commit comments

Comments
 (0)