159
159
160
160
from pandas .io .common import get_handle
161
161
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
163
163
import pandas .plotting
164
164
165
165
if TYPE_CHECKING :
@@ -2523,16 +2523,25 @@ def to_html(
2523
2523
@Substitution (
2524
2524
klass = "DataFrame" ,
2525
2525
type_sub = " and columns" ,
2526
- max_cols_sub = (
2527
- """max_cols : int, optional
2526
+ max_cols_sub = dedent (
2527
+ """\
2528
+ max_cols : int, optional
2528
2529
When to switch from the verbose to the truncated output. If the
2529
2530
DataFrame has more than `max_cols` columns, the truncated output
2530
2531
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."""
2533
2533
),
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
+ """\
2536
2545
>>> int_values = [1, 2, 3, 4, 5]
2537
2546
>>> text_values = ['alpha', 'beta', 'gamma', 'delta', 'epsilon']
2538
2547
>>> float_values = [0.0, 0.25, 0.5, 0.75, 1.0]
@@ -2615,14 +2624,15 @@ def to_html(
2615
2624
dtypes: object(3)
2616
2625
memory usage: 165.9 MB"""
2617
2626
),
2618
- see_also_sub = (
2619
- """
2627
+ see_also_sub = dedent (
2628
+ """\
2620
2629
DataFrame.describe: Generate descriptive statistics of DataFrame
2621
2630
columns.
2622
2631
DataFrame.memory_usage: Memory usage of DataFrame columns."""
2623
2632
),
2633
+ version_added_sub = "" ,
2624
2634
)
2625
- @doc (DataFrameInfo . to_buffer )
2635
+ @doc (BaseInfo . render )
2626
2636
def info (
2627
2637
self ,
2628
2638
verbose : Optional [bool ] = None ,
@@ -2635,7 +2645,7 @@ def info(
2635
2645
data = self ,
2636
2646
memory_usage = memory_usage ,
2637
2647
)
2638
- info .to_buffer (
2648
+ info .render (
2639
2649
buf = buf ,
2640
2650
max_cols = max_cols ,
2641
2651
verbose = verbose ,
0 commit comments