Skip to content

CLN: simplify io.formats.format.get_series_repr_params #44221

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 1 commit into from
Oct 29, 2021
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
2 changes: 1 addition & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1458,7 +1458,7 @@ def __repr__(self) -> str:
"""
Return a string representation for a particular Series.
"""
repr_params = fmt.get_series_repr_params(self)
repr_params = fmt.get_series_repr_params()
return self.to_string(**repr_params)

def to_string(
Expand Down
8 changes: 4 additions & 4 deletions pandas/io/formats/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ def get_dataframe_repr_params() -> dict[str, Any]:
}


def get_series_repr_params(series: Series) -> dict[str, Any]:
def get_series_repr_params() -> dict[str, Any]:
"""Get the parameters used to repr(Series) calls using Series.to_string.

Supplying these parameters to Series.to_string is equivalent to calling
Expand All @@ -529,7 +529,7 @@ def get_series_repr_params(series: Series) -> dict[str, Any]:
>>> import pandas as pd
>>>
>>> ser = pd.Series([1, 2, 3, 4])
>>> repr_params = pd.io.formats.format.get_series_repr_params(ser)
>>> repr_params = pd.io.formats.format.get_series_repr_params()
>>> repr(ser) == ser.to_string(**repr_params)
True
"""
Expand All @@ -546,8 +546,8 @@ def get_series_repr_params(series: Series) -> dict[str, Any]:
)

return {
"name": series.name,
"dtype": series.dtype,
"name": True,
"dtype": True,
"min_rows": min_rows,
"max_rows": max_rows,
"length": get_option("display.show_dimensions"),
Expand Down