Skip to content

ENH: enable Series.info() #37320

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

Merged
merged 34 commits into from
Dec 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a903f32
TST: add series info tests
ivanovmg Oct 7, 2020
e07d6e2
TST: remove test that series has no info
ivanovmg Oct 7, 2020
0990d54
ENH: add method Series.info
ivanovmg Oct 7, 2020
1814795
REF: split tests for frame and series
ivanovmg Oct 7, 2020
4c390a8
REF: param test on frame memory_usage_qualified
ivanovmg Oct 7, 2020
81929e6
Merge branch 'master' into feature/series-info
ivanovmg Oct 21, 2020
824d8d6
ENH: enable series info
ivanovmg Oct 21, 2020
ce68e94
CLN: remove extra parens
ivanovmg Oct 21, 2020
ede6dc4
REF: split series-related tests
ivanovmg Oct 23, 2020
789e03e
DOC: add release note
ivanovmg Oct 23, 2020
f41596d
CLN: merge two lines
ivanovmg Oct 23, 2020
40b71f8
DOC: unify series/frame docstrings, fix indent
ivanovmg Oct 23, 2020
3e71336
REF: to_buffer -> render, unify func signature
ivanovmg Oct 23, 2020
739c62d
Merge branch 'master' into feature/series-info
ivanovmg Oct 23, 2020
e9c5220
DOC: add versionadded tag
ivanovmg Oct 23, 2020
f7cb4f8
Merge branch 'master' into feature/series-info
ivanovmg Nov 4, 2020
def5ed6
Merge branch 'master' into feature/series-info
ivanovmg Nov 5, 2020
dd4205d
Merge branch 'master' into feature/series-info
ivanovmg Nov 7, 2020
e74cdce
DOC: maybe fix empty line problem with df.info
ivanovmg Nov 7, 2020
d41ecf1
DOC: remove trailing period in type
ivanovmg Nov 7, 2020
98d0f55
Merge branch 'master' into feature/series-info
ivanovmg Nov 12, 2020
0d1c5d8
Merge branch 'master' into feature/series-info
ivanovmg Oct 4, 2021
816803e
Fix styling
ivanovmg Oct 4, 2021
9e0198f
Merge branch 'master' into feature/series-info
ivanovmg Nov 29, 2021
1e2aaef
DOC: move whatsnew info to v1.4.0
ivanovmg Nov 29, 2021
688080b
DOC: move docs on Series.info() to io/formats/info.py
ivanovmg Nov 29, 2021
4e87b1a
FIX: newline
ivanovmg Nov 29, 2021
dc999fe
FIX: change versionadded to 1.4.0
ivanovmg Nov 29, 2021
4bb4e40
DOC: extract null_counts_sub for frames only
ivanovmg Nov 29, 2021
f114293
DOC: avoid duplication of kwargs replacement
ivanovmg Nov 29, 2021
16ac96e
DOC: unify newlines/spacing with substitutions
ivanovmg Nov 29, 2021
aac2954
Revert "DOC: unify newlines/spacing with substitutions"
ivanovmg Nov 29, 2021
22303dc
DOC: fix newlines substitutions
ivanovmg Nov 29, 2021
9428a32
DOC: another attempt to fix newline
ivanovmg Nov 30, 2021
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
1 change: 1 addition & 0 deletions doc/source/whatsnew/v1.4.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ Other enhancements
- Added "Juneteenth National Independence Day" to
``USFederalHolidayCalendar``. See also `Other API changes`_.
- :meth:`.Rolling.var`, :meth:`.Expanding.var`, :meth:`.Rolling.std`, :meth:`.Expanding.std` now support `Numba <http://numba.pydata.org/>`_ execution with the ``engine`` keyword (:issue:`44461`)
- :meth:`Series.info` has been added, for compatibility with :meth:`DataFrame.info` (:issue:`5167`)


.. ---------------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@
format as fmt,
)
from pandas.io.formats.info import (
INFO_DOCSTRING,
DataFrameInfo,
frame_sub_kwargs,
)
Expand Down Expand Up @@ -3138,7 +3139,7 @@ def to_xml(
return xml_formatter.write_output()

# ----------------------------------------------------------------------
@doc(DataFrameInfo.render, **frame_sub_kwargs)
@doc(INFO_DOCSTRING, **frame_sub_kwargs)
def info(
self,
verbose: bool | None = None,
Expand Down
21 changes: 21 additions & 0 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@
from pandas.core.tools.datetimes import to_datetime

import pandas.io.formats.format as fmt
from pandas.io.formats.info import (
INFO_DOCSTRING,
SeriesInfo,
series_sub_kwargs,
)
import pandas.plotting

if TYPE_CHECKING:
Expand Down Expand Up @@ -4914,6 +4919,22 @@ def replace(
method=method,
)

@doc(INFO_DOCSTRING, **series_sub_kwargs)
def info(
self,
verbose: bool | None = None,
buf: IO[str] | None = None,
max_cols: int | None = None,
memory_usage: bool | str | None = None,
show_counts: bool = True,
) -> None:
return SeriesInfo(self, memory_usage).render(
buf=buf,
max_cols=max_cols,
verbose=verbose,
show_counts=show_counts,
)

def _replace_single(self, to_replace, method: str, inplace: bool, limit):
"""
Replaces values in a Series using the fill method specified when no
Expand Down
Loading