Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REF: prepare dataframe info for series info #37868

Merged
merged 7 commits into from
Nov 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
simonjayhawkins marked this conversation as resolved.
Show resolved Hide resolved
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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you do a followup where you switch to using @doc before the Series.info change

"""\
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