|
53 | 53 | ) |
54 | 54 |
|
55 | 55 |
|
| 56 | +show_counts_sub = dedent( |
| 57 | + """\ |
| 58 | + show_counts : bool, optional |
| 59 | + Whether to show the non-null counts.""" |
| 60 | +) |
| 61 | + |
| 62 | + |
56 | 63 | frame_examples_sub = dedent( |
57 | 64 | """\ |
58 | 65 | >>> int_values = [1, 2, 3, 4, 5] |
|
147 | 154 | ) |
148 | 155 |
|
149 | 156 |
|
| 157 | +frame_sub_kwargs = dict( |
| 158 | + klass="DataFrame", |
| 159 | + type_sub=" and columns", |
| 160 | + max_cols_sub=frame_max_cols_sub, |
| 161 | + null_counts_sub=frame_null_counts_sub, |
| 162 | + show_counts_sub=show_counts_sub, |
| 163 | + examples_sub=frame_examples_sub, |
| 164 | + see_also_sub=frame_see_also_sub, |
| 165 | + version_added_sub="", |
| 166 | +) |
| 167 | + |
| 168 | + |
| 169 | +INFO_DOCSTRING = dedent( |
| 170 | + """\ |
| 171 | + Print a concise summary of a {klass}. |
| 172 | +
|
| 173 | + This method prints information about a {klass} including |
| 174 | + the index dtype{type_sub}, non-null values and memory usage. |
| 175 | + {version_added_sub}\ |
| 176 | +
|
| 177 | + Parameters |
| 178 | + ---------- |
| 179 | + data : {klass} |
| 180 | + {klass} to print information about. |
| 181 | + verbose : bool, optional |
| 182 | + Whether to print the full summary. By default, the setting in |
| 183 | + ``pandas.options.display.max_info_columns`` is followed. |
| 184 | + buf : writable buffer, defaults to sys.stdout |
| 185 | + Where to send the output. By default, the output is printed to |
| 186 | + sys.stdout. Pass a writable buffer if you need to further process |
| 187 | + the output. |
| 188 | + {max_cols_sub} |
| 189 | + memory_usage : bool, str, optional |
| 190 | + Specifies whether total memory usage of the {klass} |
| 191 | + elements (including the index) should be displayed. By default, |
| 192 | + this follows the ``pandas.options.display.memory_usage`` setting. |
| 193 | +
|
| 194 | + True always show memory usage. False never shows memory usage. |
| 195 | + A value of 'deep' is equivalent to "True with deep introspection". |
| 196 | + Memory usage is shown in human-readable units (base-2 |
| 197 | + representation). Without deep introspection a memory estimation is |
| 198 | + made based in column dtype and number of rows assuming values |
| 199 | + consume the same memory amount for corresponding dtypes. With deep |
| 200 | + memory introspection, a real memory usage calculation is performed |
| 201 | + at the cost of computational resources. |
| 202 | + {show_counts_sub}s |
| 203 | +
|
| 204 | + Returns |
| 205 | + ------- |
| 206 | + None |
| 207 | + This method prints a summary of a {klass} and returns None. |
| 208 | +
|
| 209 | + See Also |
| 210 | + -------- |
| 211 | + {see_also_sub} |
| 212 | +
|
| 213 | + Examples |
| 214 | + -------- |
| 215 | + {examples_sub} |
| 216 | + """ |
| 217 | +) |
| 218 | + |
| 219 | + |
150 | 220 | def _put_str(s: str | Dtype, space: int) -> str: |
151 | 221 | """ |
152 | 222 | Make string of specified length, padding to the right if necessary. |
@@ -293,53 +363,7 @@ def render( |
293 | 363 | verbose: bool | None, |
294 | 364 | show_counts: bool | None, |
295 | 365 | ) -> None: |
296 | | - """ |
297 | | - Print a concise summary of a {klass}. |
298 | | -
|
299 | | - This method prints information about a {klass} including |
300 | | - the index dtype{type_sub}, non-null values and memory usage. |
301 | | - {version_added_sub}\ |
302 | | -
|
303 | | - Parameters |
304 | | - ---------- |
305 | | - data : {klass} |
306 | | - {klass} to print information about. |
307 | | - verbose : bool, optional |
308 | | - Whether to print the full summary. By default, the setting in |
309 | | - ``pandas.options.display.max_info_columns`` is followed. |
310 | | - buf : writable buffer, defaults to sys.stdout |
311 | | - Where to send the output. By default, the output is printed to |
312 | | - sys.stdout. Pass a writable buffer if you need to further process |
313 | | - the output. |
314 | | - {max_cols_sub} |
315 | | - memory_usage : bool, str, optional |
316 | | - Specifies whether total memory usage of the {klass} |
317 | | - elements (including the index) should be displayed. By default, |
318 | | - this follows the ``pandas.options.display.memory_usage`` setting. |
319 | | -
|
320 | | - True always show memory usage. False never shows memory usage. |
321 | | - A value of 'deep' is equivalent to "True with deep introspection". |
322 | | - Memory usage is shown in human-readable units (base-2 |
323 | | - representation). Without deep introspection a memory estimation is |
324 | | - made based in column dtype and number of rows assuming values |
325 | | - consume the same memory amount for corresponding dtypes. With deep |
326 | | - memory introspection, a real memory usage calculation is performed |
327 | | - at the cost of computational resources. |
328 | | - %(show_counts_sub)s |
329 | | -
|
330 | | - Returns |
331 | | - ------- |
332 | | - None |
333 | | - This method prints a summary of a {klass} and returns None. |
334 | | -
|
335 | | - See Also |
336 | | - -------- |
337 | | - {see_also_sub} |
338 | | -
|
339 | | - Examples |
340 | | - -------- |
341 | | - {examples_sub} |
342 | | - """ |
| 366 | + pass |
343 | 367 |
|
344 | 368 |
|
345 | 369 | class DataFrameInfo(BaseInfo): |
@@ -402,11 +426,12 @@ def memory_usage_bytes(self) -> int: |
402 | 426 | return self.data.memory_usage(index=True, deep=deep).sum() |
403 | 427 |
|
404 | 428 | @doc( |
405 | | - BaseInfo.render, |
| 429 | + INFO_DOCSTRING, |
406 | 430 | klass="DataFrame", |
407 | 431 | type_sub=" and columns", |
408 | 432 | max_cols_sub=frame_max_cols_sub, |
409 | 433 | null_counts_sub=frame_null_counts_sub, |
| 434 | + show_counts_sub=show_counts_sub, |
410 | 435 | examples_sub=frame_examples_sub, |
411 | 436 | see_also_sub=frame_see_also_sub, |
412 | 437 | version_added_sub="", |
|
0 commit comments