Skip to content

Commit

Permalink
REF: prepare dataframe info for series info (#37868)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanovmg committed Nov 24, 2020
1 parent de919ff commit db0cd36
Show file tree
Hide file tree
Showing 2 changed files with 297 additions and 224 deletions.
32 changes: 21 additions & 11 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@

from pandas.io.common import get_handle
from pandas.io.formats import console, format as fmt
from pandas.io.formats.info import DataFrameInfo
from pandas.io.formats.info import BaseInfo, DataFrameInfo
import pandas.plotting

if TYPE_CHECKING:
Expand Down Expand Up @@ -2523,16 +2523,25 @@ def to_html(
@Substitution(
klass="DataFrame",
type_sub=" and columns",
max_cols_sub=(
"""max_cols : int, optional
max_cols_sub=dedent(
"""\
max_cols : int, optional
When to switch from the verbose to the truncated output. If the
DataFrame has more than `max_cols` columns, the truncated output
is used. By default, the setting in
``pandas.options.display.max_info_columns`` is used.
"""
``pandas.options.display.max_info_columns`` is used."""
),
examples_sub=(
"""
null_counts_sub=dedent(
"""\
null_counts : bool, optional
Whether to show the non-null counts. By default, this is shown
only if the DataFrame is smaller than
``pandas.options.display.max_info_rows`` and
``pandas.options.display.max_info_columns``. A value of True always
shows the counts, and False never shows the counts."""
),
examples_sub=dedent(
"""\
>>> int_values = [1, 2, 3, 4, 5]
>>> text_values = ['alpha', 'beta', 'gamma', 'delta', 'epsilon']
>>> float_values = [0.0, 0.25, 0.5, 0.75, 1.0]
Expand Down Expand Up @@ -2615,14 +2624,15 @@ def to_html(
dtypes: object(3)
memory usage: 165.9 MB"""
),
see_also_sub=(
"""
see_also_sub=dedent(
"""\
DataFrame.describe: Generate descriptive statistics of DataFrame
columns.
DataFrame.memory_usage: Memory usage of DataFrame columns."""
),
version_added_sub="",
)
@doc(DataFrameInfo.to_buffer)
@doc(BaseInfo.render)
def info(
self,
verbose: Optional[bool] = None,
Expand All @@ -2635,7 +2645,7 @@ def info(
data=self,
memory_usage=memory_usage,
)
info.to_buffer(
info.render(
buf=buf,
max_cols=max_cols,
verbose=verbose,
Expand Down
Loading

0 comments on commit db0cd36

Please sign in to comment.