Skip to content

Commit db0cd36

Browse files
authored
REF: prepare dataframe info for series info (#37868)
1 parent de919ff commit db0cd36

File tree

2 files changed

+297
-224
lines changed

2 files changed

+297
-224
lines changed

pandas/core/frame.py

+21-11
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159

160160
from pandas.io.common import get_handle
161161
from pandas.io.formats import console, format as fmt
162-
from pandas.io.formats.info import DataFrameInfo
162+
from pandas.io.formats.info import BaseInfo, DataFrameInfo
163163
import pandas.plotting
164164

165165
if TYPE_CHECKING:
@@ -2523,16 +2523,25 @@ def to_html(
25232523
@Substitution(
25242524
klass="DataFrame",
25252525
type_sub=" and columns",
2526-
max_cols_sub=(
2527-
"""max_cols : int, optional
2526+
max_cols_sub=dedent(
2527+
"""\
2528+
max_cols : int, optional
25282529
When to switch from the verbose to the truncated output. If the
25292530
DataFrame has more than `max_cols` columns, the truncated output
25302531
is used. By default, the setting in
2531-
``pandas.options.display.max_info_columns`` is used.
2532-
"""
2532+
``pandas.options.display.max_info_columns`` is used."""
25332533
),
2534-
examples_sub=(
2535-
"""
2534+
null_counts_sub=dedent(
2535+
"""\
2536+
null_counts : bool, optional
2537+
Whether to show the non-null counts. By default, this is shown
2538+
only if the DataFrame is smaller than
2539+
``pandas.options.display.max_info_rows`` and
2540+
``pandas.options.display.max_info_columns``. A value of True always
2541+
shows the counts, and False never shows the counts."""
2542+
),
2543+
examples_sub=dedent(
2544+
"""\
25362545
>>> int_values = [1, 2, 3, 4, 5]
25372546
>>> text_values = ['alpha', 'beta', 'gamma', 'delta', 'epsilon']
25382547
>>> float_values = [0.0, 0.25, 0.5, 0.75, 1.0]
@@ -2615,14 +2624,15 @@ def to_html(
26152624
dtypes: object(3)
26162625
memory usage: 165.9 MB"""
26172626
),
2618-
see_also_sub=(
2619-
"""
2627+
see_also_sub=dedent(
2628+
"""\
26202629
DataFrame.describe: Generate descriptive statistics of DataFrame
26212630
columns.
26222631
DataFrame.memory_usage: Memory usage of DataFrame columns."""
26232632
),
2633+
version_added_sub="",
26242634
)
2625-
@doc(DataFrameInfo.to_buffer)
2635+
@doc(BaseInfo.render)
26262636
def info(
26272637
self,
26282638
verbose: Optional[bool] = None,
@@ -2635,7 +2645,7 @@ def info(
26352645
data=self,
26362646
memory_usage=memory_usage,
26372647
)
2638-
info.to_buffer(
2648+
info.render(
26392649
buf=buf,
26402650
max_cols=max_cols,
26412651
verbose=verbose,

0 commit comments

Comments
 (0)