From bc4cc76e3662fcdc21e373654809dbf9a338dd0c Mon Sep 17 00:00:00 2001 From: ramvikrams Date: Sat, 8 Apr 2023 16:12:44 +0530 Subject: [PATCH 1/9] added arguments --- pandas-stubs/core/frame.pyi | 10 +++++++--- pandas-stubs/core/series.pyi | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index c8e2cdff7..f1e734e39 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -270,6 +270,7 @@ class DataFrame(NDFrame, OpsMixin): self, orient: Literal["dict", "list", "series", "split", "tight", "index"], into: Mapping | type[Mapping], + index: bool = True, ) -> Mapping[Hashable, Any]: ... @overload def to_dict( @@ -277,22 +278,25 @@ class DataFrame(NDFrame, OpsMixin): orient: Literal["dict", "list", "series", "split", "tight", "index"] = ..., *, into: Mapping | type[Mapping], + index: bool = True, ) -> Mapping[Hashable, Any]: ... @overload def to_dict( self, orient: Literal["dict", "list", "series", "split", "tight", "index"] = ..., into: None = ..., + index: bool = True, ) -> dict[Hashable, Any]: ... @overload def to_dict( self, orient: Literal["records"], into: Mapping | type[Mapping], + index: bool = True, ) -> list[Mapping[Hashable, Any]]: ... @overload def to_dict( - self, orient: Literal["records"], into: None = ... + self, orient: Literal["records"], into: None, index: bool = True, ) -> list[dict[Hashable, Any]]: ... def to_gbq( self, @@ -1400,8 +1404,8 @@ class DataFrame(NDFrame, OpsMixin): level: Level | None = ..., fill_value: float | None = ..., ) -> DataFrame: ... - def add_prefix(self, prefix: _str) -> DataFrame: ... - def add_suffix(self, suffix: _str) -> DataFrame: ... + def add_prefix(self, prefix: _str, axis: Axis | None = None) -> DataFrame: ... + def add_suffix(self, suffix: _str, axis: Axis | None = None) -> DataFrame: ... @overload def all( self, diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index c87bb2af1..638e2fac9 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -1024,8 +1024,8 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): def pop(self, item: Hashable) -> S1: ... def squeeze(self, axis: AxisIndex | None = ...) -> Scalar: ... def __abs__(self) -> Series[S1]: ... - def add_prefix(self, prefix: _str) -> Series[S1]: ... - def add_suffix(self, suffix: _str) -> Series[S1]: ... + def add_prefix(self, prefix: _str, axis: Axis | None = None) -> Series[S1]: ... + def add_suffix(self, suffix: _str, axis: Axis | None = None) -> Series[S1]: ... def reindex( self, index: Axes | None = ..., From 61f2936a012643f9ad382d11c136ed6e382c313f Mon Sep 17 00:00:00 2001 From: ramvikrams Date: Mon, 10 Apr 2023 10:51:40 +0530 Subject: [PATCH 2/9] changed axis parameters --- pandas-stubs/core/series.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index 638e2fac9..227458764 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -1024,8 +1024,8 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): def pop(self, item: Hashable) -> S1: ... def squeeze(self, axis: AxisIndex | None = ...) -> Scalar: ... def __abs__(self) -> Series[S1]: ... - def add_prefix(self, prefix: _str, axis: Axis | None = None) -> Series[S1]: ... - def add_suffix(self, suffix: _str, axis: Axis | None = None) -> Series[S1]: ... + def add_prefix(self, prefix: _str, axis: AxisIndex | None = ...) -> Series[S1]: ... + def add_suffix(self, suffix: _str, axis: AxisIndex | None = ...) -> Series[S1]: ... def reindex( self, index: Axes | None = ..., From 094b15567452576dff246627d7dc40d3e3261271 Mon Sep 17 00:00:00 2001 From: ramvikrams Date: Mon, 10 Apr 2023 22:33:30 +0530 Subject: [PATCH 3/9] req changes and created a different overload and corrected index args --- pandas-stubs/core/frame.pyi | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index f1e734e39..6ecdc15bf 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -268,36 +268,46 @@ class DataFrame(NDFrame, OpsMixin): @overload def to_dict( self, - orient: Literal["dict", "list", "series", "split", "tight", "index"], + orient: Literal["dict", "list", "series", "index"], into: Mapping | type[Mapping], - index: bool = True, + index: Literal[True] = True, ) -> Mapping[Hashable, Any]: ... @overload def to_dict( self, - orient: Literal["dict", "list", "series", "split", "tight", "index"] = ..., + orient: Literal["dict", "list", "series", "index"] = ..., *, into: Mapping | type[Mapping], - index: bool = True, + index: Literal[True] = True, ) -> Mapping[Hashable, Any]: ... @overload def to_dict( self, - orient: Literal["dict", "list", "series", "split", "tight", "index"] = ..., + orient: Literal["dict", "list", "series", "index"] = ..., into: None = ..., - index: bool = True, + index: Literal[True] = True, ) -> dict[Hashable, Any]: ... @overload def to_dict( self, orient: Literal["records"], into: Mapping | type[Mapping], - index: bool = True, + index: Literal[True] = True, ) -> list[Mapping[Hashable, Any]]: ... @overload def to_dict( - self, orient: Literal["records"], into: None, index: bool = True, + self, + orient: Literal["records"], + into: None, + index: Literal[True] = True, ) -> list[dict[Hashable, Any]]: ... + @overload + def to_dict( + self, + orient: Literal["split", "tight"] = ..., + into: None = ..., + index: bool = ..., + ) -> dict[Hashable, Any]: ... def to_gbq( self, destination_table: str, From aa2d0c7e7dc8e2a9fd4fc1ca4b5e1b67107fe116 Mon Sep 17 00:00:00 2001 From: ramvikrams Date: Tue, 11 Apr 2023 10:30:47 +0530 Subject: [PATCH 4/9] creating overloads --- pandas-stubs/core/frame.pyi | 59 +++++++++++++++++++++++++++---------- tests/test_frame.py | 2 +- 2 files changed, 45 insertions(+), 16 deletions(-) diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index 6ecdc15bf..8eb10530b 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -266,45 +266,74 @@ class DataFrame(NDFrame, OpsMixin): na_value: Scalar = ..., ) -> np.ndarray: ... @overload + def to_dict( + self, + orient: Literal["records"], + into: Mapping | type[Mapping], + index: Literal[True] = ..., + ) -> list[Mapping[Hashable, Any]]: ... + # @overload + # def to_dict( + # self, + # orient: Literal["records"], + # into: Mapping | type[Mapping], + # index: bool = ..., + # ) -> list[Mapping[Hashable, Any]]: ... + @overload + def to_dict( + self, + orient: Literal["records"], + into: None, + index: Literal[True] = ..., + ) -> list[dict[Hashable, Any]]: ... + # @overload + # def to_dict( + # self, + # orient: Literal["records"], + # into: None, + # index: bool = ..., + # ) -> list[dict[Hashable, Any]]: ... + @overload def to_dict( self, orient: Literal["dict", "list", "series", "index"], into: Mapping | type[Mapping], - index: Literal[True] = True, + index: Literal[True] = ..., ) -> Mapping[Hashable, Any]: ... @overload def to_dict( self, - orient: Literal["dict", "list", "series", "index"] = ..., - *, + orient: Literal["split", "tight"], into: Mapping | type[Mapping], - index: Literal[True] = True, + index: bool = ..., ) -> Mapping[Hashable, Any]: ... @overload def to_dict( self, orient: Literal["dict", "list", "series", "index"] = ..., - into: None = ..., - index: Literal[True] = True, - ) -> dict[Hashable, Any]: ... + *, + into: Mapping | type[Mapping], + index: Literal[True] = ..., + ) -> Mapping[Hashable, Any]: ... @overload def to_dict( self, - orient: Literal["records"], + orient: Literal["split","tight"] = ..., + *, into: Mapping | type[Mapping], - index: Literal[True] = True, - ) -> list[Mapping[Hashable, Any]]: ... + index: bool= ..., + ) -> Mapping[Hashable, Any]: ... @overload def to_dict( self, - orient: Literal["records"], - into: None, - index: Literal[True] = True, - ) -> list[dict[Hashable, Any]]: ... + orient: Literal["dict", "list", "series", "index"] = ..., + into: None = ..., + index: Literal[True] = ..., + ) -> dict[Hashable, Any]: ... @overload def to_dict( self, - orient: Literal["split", "tight"] = ..., + orient: Literal["split","target"] = ..., into: None = ..., index: bool = ..., ) -> dict[Hashable, Any]: ... diff --git a/tests/test_frame.py b/tests/test_frame.py index 03d8299c4..46eb6115f 100644 --- a/tests/test_frame.py +++ b/tests/test_frame.py @@ -2131,7 +2131,7 @@ def test_to_dict(): defaultdict, ) target = defaultdict(list) - check(assert_type(DF.to_dict("records"), List[Dict[Hashable, Any]]), list) + check(assert_type(DF.to_dict("records"), Any), list) check( assert_type(DF.to_dict("records", into=target), List[Mapping[Hashable, Any]]), list, From 71d5b9dd0853b87b98ae65b73eb51111d006ecd7 Mon Sep 17 00:00:00 2001 From: ramvikrams Date: Tue, 11 Apr 2023 10:31:10 +0530 Subject: [PATCH 5/9] Update frame.pyi --- pandas-stubs/core/frame.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index 8eb10530b..a822037fa 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -318,10 +318,10 @@ class DataFrame(NDFrame, OpsMixin): @overload def to_dict( self, - orient: Literal["split","tight"] = ..., + orient: Literal["split", "tight"] = ..., *, into: Mapping | type[Mapping], - index: bool= ..., + index: bool = ..., ) -> Mapping[Hashable, Any]: ... @overload def to_dict( @@ -333,7 +333,7 @@ class DataFrame(NDFrame, OpsMixin): @overload def to_dict( self, - orient: Literal["split","target"] = ..., + orient: Literal["split", "target"] = ..., into: None = ..., index: bool = ..., ) -> dict[Hashable, Any]: ... From 583dfa4ced7a720aae27c7fcc47f2f222fa572f7 Mon Sep 17 00:00:00 2001 From: ramvikrams Date: Tue, 11 Apr 2023 21:53:45 +0530 Subject: [PATCH 6/9] corrected diff overload args --- pandas-stubs/core/frame.pyi | 22 ++++------------------ tests/test_frame.py | 2 +- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index a822037fa..da4ae4add 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -270,29 +270,15 @@ class DataFrame(NDFrame, OpsMixin): self, orient: Literal["records"], into: Mapping | type[Mapping], - index: Literal[True] = ..., + index: bool = ..., ) -> list[Mapping[Hashable, Any]]: ... - # @overload - # def to_dict( - # self, - # orient: Literal["records"], - # into: Mapping | type[Mapping], - # index: bool = ..., - # ) -> list[Mapping[Hashable, Any]]: ... @overload def to_dict( self, orient: Literal["records"], - into: None, - index: Literal[True] = ..., + into: None = ..., + index: bool = ..., ) -> list[dict[Hashable, Any]]: ... - # @overload - # def to_dict( - # self, - # orient: Literal["records"], - # into: None, - # index: bool = ..., - # ) -> list[dict[Hashable, Any]]: ... @overload def to_dict( self, @@ -333,7 +319,7 @@ class DataFrame(NDFrame, OpsMixin): @overload def to_dict( self, - orient: Literal["split", "target"] = ..., + orient: Literal["split", "tight"] = ..., into: None = ..., index: bool = ..., ) -> dict[Hashable, Any]: ... diff --git a/tests/test_frame.py b/tests/test_frame.py index 46eb6115f..03d8299c4 100644 --- a/tests/test_frame.py +++ b/tests/test_frame.py @@ -2131,7 +2131,7 @@ def test_to_dict(): defaultdict, ) target = defaultdict(list) - check(assert_type(DF.to_dict("records"), Any), list) + check(assert_type(DF.to_dict("records"), List[Dict[Hashable, Any]]), list) check( assert_type(DF.to_dict("records", into=target), List[Mapping[Hashable, Any]]), list, From c9d0f5409072e4b313220d486db2508ab28f964d Mon Sep 17 00:00:00 2001 From: ramvikrams Date: Tue, 11 Apr 2023 23:03:32 +0530 Subject: [PATCH 7/9] added the tests --- pandas-stubs/core/frame.pyi | 4 ++-- tests/test_frame.py | 48 +++++++++++++++++++++++++++++++++++++ tests/test_series.py | 8 +++++++ 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index da4ae4add..dc88eb28f 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -270,14 +270,14 @@ class DataFrame(NDFrame, OpsMixin): self, orient: Literal["records"], into: Mapping | type[Mapping], - index: bool = ..., + index: Literal[True] = ..., ) -> list[Mapping[Hashable, Any]]: ... @overload def to_dict( self, orient: Literal["records"], into: None = ..., - index: bool = ..., + index: Literal[True] = ..., ) -> list[dict[Hashable, Any]]: ... @overload def to_dict( diff --git a/tests/test_frame.py b/tests/test_frame.py index 03d8299c4..5067e1aca 100644 --- a/tests/test_frame.py +++ b/tests/test_frame.py @@ -2526,3 +2526,51 @@ def test_loc_returns_series() -> None: df1 = pd.DataFrame({"x": [1, 2, 3, 4]}, index=[10, 20, 30, 40]) df2 = df1.loc[10, :] check(assert_type(df2, Union[pd.Series, pd.DataFrame]), pd.Series) + + +def test_to_dict_index() -> None: + df = pd.DataFrame({"a": [1, 2], "b": [9, 10]}) + check( + assert_type( + df.to_dict(orient="records", index=True), List[Dict[Hashable, Any]] + ), + list, + ) + check(assert_type(df.to_dict(orient="dict", index=True), dict[Hashable, Any]), dict) + check( + assert_type(df.to_dict(orient="series", index=True), dict[Hashable, Any]), dict + ) + check( + assert_type(df.to_dict(orient="index", index=True), dict[Hashable, Any]), dict + ) + check( + assert_type(df.to_dict(orient="index", index=True), dict[Hashable, Any]), dict + ) + check( + assert_type(df.to_dict(orient="split", index=True), dict[Hashable, Any]), dict + ) + check( + assert_type(df.to_dict(orient="tight", index=True), dict[Hashable, Any]), dict + ) + check( + assert_type(df.to_dict(orient="tight", index=False), dict[Hashable, Any]), dict + ) + check( + assert_type(df.to_dict(orient="split", index=False), dict[Hashable, Any]), dict + ) + if TYPE_CHECKING_INVALID_USAGE: + check(assert_type(df.to_dict(orient="records", index=False), List[Dict[Hashable, Any]]), list) # type: ignore[assert-type, call-overload] # pyright: ignore[reportGeneralTypeIssues] + check(assert_type(df.to_dict(orient="dict", index=False), dict[Hashable, Any]), dict) # type: ignore[assert-type, call-overload] # pyright: ignore[reportGeneralTypeIssues] + check(assert_type(df.to_dict(orient="series", index=False), dict[Hashable, Any]), dict) # type: ignore[assert-type, call-overload] # pyright: ignore[reportGeneralTypeIssues] + check(assert_type(df.to_dict(orient="index", index=False), dict[Hashable, Any]), dict) # type: ignore[assert-type, call-overload] # pyright: ignore[reportGeneralTypeIssues] + check(assert_type(df.to_dict(orient="index", index=False), dict[Hashable, Any]), dict) # type: ignore[assert-type, call-overload] # pyright: ignore[reportGeneralTypeIssues] + + +def test_suffix_prefix_index() -> None: + df = pd.DataFrame({"A": [1, 2, 3, 4], "B": [3, 4, 5, 6]}) + check(assert_type(df.add_suffix("_col", axis=1), pd.DataFrame), pd.DataFrame) + check(assert_type(df.add_suffix("_col", axis="index"), pd.DataFrame), pd.DataFrame) + check(assert_type(df.add_prefix("_col", axis="index"), pd.DataFrame), pd.DataFrame) + check( + assert_type(df.add_prefix("_col", axis="columns"), pd.DataFrame), pd.DataFrame + ) diff --git a/tests/test_series.py b/tests/test_series.py index 543aac5b1..8a22feb36 100644 --- a/tests/test_series.py +++ b/tests/test_series.py @@ -1813,3 +1813,11 @@ def test_types_apply_set() -> None: {"list1": [1, 2, 3], "list2": ["a", "b", "c"], "list3": [True, False, True]} ) check(assert_type(series_of_lists.apply(lambda x: set(x)), pd.Series), pd.Series) + + +def test_prefix_summix_axis() -> None: + s = pd.Series([1, 2, 3, 4]) + check(assert_type(s.add_suffix("_item", axis=0), pd.Series), pd.Series) + check(assert_type(s.add_suffix("_item", axis="index"), pd.Series), pd.Series) + check(assert_type(s.add_prefix("_item", axis=0), pd.Series), pd.Series) + check(assert_type(s.add_prefix("_item", axis="index"), pd.Series), pd.Series) From 4f4c87fd49aaf4131999cbdc5059f3c479bd16e3 Mon Sep 17 00:00:00 2001 From: ramvikrams Date: Wed, 12 Apr 2023 13:37:20 +0530 Subject: [PATCH 8/9] corrected the tests --- tests/test_frame.py | 24 ++++++++++-------------- tests/test_series.py | 6 ++++++ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/tests/test_frame.py b/tests/test_frame.py index 5067e1aca..893eb46f0 100644 --- a/tests/test_frame.py +++ b/tests/test_frame.py @@ -2536,34 +2536,30 @@ def test_to_dict_index() -> None: ), list, ) - check(assert_type(df.to_dict(orient="dict", index=True), dict[Hashable, Any]), dict) + check(assert_type(df.to_dict(orient="dict", index=True), Dict[Hashable, Any]), dict) check( - assert_type(df.to_dict(orient="series", index=True), dict[Hashable, Any]), dict + assert_type(df.to_dict(orient="series", index=True), Dict[Hashable, Any]), dict ) check( - assert_type(df.to_dict(orient="index", index=True), dict[Hashable, Any]), dict + assert_type(df.to_dict(orient="index", index=True), Dict[Hashable, Any]), dict ) check( - assert_type(df.to_dict(orient="index", index=True), dict[Hashable, Any]), dict + assert_type(df.to_dict(orient="split", index=True), Dict[Hashable, Any]), dict ) check( - assert_type(df.to_dict(orient="split", index=True), dict[Hashable, Any]), dict + assert_type(df.to_dict(orient="tight", index=True), Dict[Hashable, Any]), dict ) check( - assert_type(df.to_dict(orient="tight", index=True), dict[Hashable, Any]), dict + assert_type(df.to_dict(orient="tight", index=False), Dict[Hashable, Any]), dict ) check( - assert_type(df.to_dict(orient="tight", index=False), dict[Hashable, Any]), dict - ) - check( - assert_type(df.to_dict(orient="split", index=False), dict[Hashable, Any]), dict + assert_type(df.to_dict(orient="split", index=False), Dict[Hashable, Any]), dict ) if TYPE_CHECKING_INVALID_USAGE: check(assert_type(df.to_dict(orient="records", index=False), List[Dict[Hashable, Any]]), list) # type: ignore[assert-type, call-overload] # pyright: ignore[reportGeneralTypeIssues] - check(assert_type(df.to_dict(orient="dict", index=False), dict[Hashable, Any]), dict) # type: ignore[assert-type, call-overload] # pyright: ignore[reportGeneralTypeIssues] - check(assert_type(df.to_dict(orient="series", index=False), dict[Hashable, Any]), dict) # type: ignore[assert-type, call-overload] # pyright: ignore[reportGeneralTypeIssues] - check(assert_type(df.to_dict(orient="index", index=False), dict[Hashable, Any]), dict) # type: ignore[assert-type, call-overload] # pyright: ignore[reportGeneralTypeIssues] - check(assert_type(df.to_dict(orient="index", index=False), dict[Hashable, Any]), dict) # type: ignore[assert-type, call-overload] # pyright: ignore[reportGeneralTypeIssues] + check(assert_type(df.to_dict(orient="dict", index=False), Dict[Hashable, Any]), dict) # type: ignore[assert-type, call-overload] # pyright: ignore[reportGeneralTypeIssues] + check(assert_type(df.to_dict(orient="series", index=False), Dict[Hashable, Any]), dict) # type: ignore[assert-type, call-overload] # pyright: ignore[reportGeneralTypeIssues] + check(assert_type(df.to_dict(orient="index", index=False), Dict[Hashable, Any]), dict) # type: ignore[assert-type, call-overload] # pyright: ignore[reportGeneralTypeIssues] def test_suffix_prefix_index() -> None: diff --git a/tests/test_series.py b/tests/test_series.py index 8a22feb36..3a567cd3c 100644 --- a/tests/test_series.py +++ b/tests/test_series.py @@ -1821,3 +1821,9 @@ def test_prefix_summix_axis() -> None: check(assert_type(s.add_suffix("_item", axis="index"), pd.Series), pd.Series) check(assert_type(s.add_prefix("_item", axis=0), pd.Series), pd.Series) check(assert_type(s.add_prefix("_item", axis="index"), pd.Series), pd.Series) + + if TYPE_CHECKING_INVALID_USAGE: + check(assert_type(s.add_prefix("_item", axis=1), pd.Series), pd.Series) # type: ignore[arg-type] # pyright: ignore[reportGeneralTypeIssues] + check(assert_type(s.add_suffix("_item", axis=1), pd.Series), pd.Series) # type: ignore[arg-type] # pyright: ignore[reportGeneralTypeIssues] + check(assert_type(s.add_prefix("_item", axis="columns"), pd.Series), pd.Series) # type: ignore[arg-type] # pyright: ignore[reportGeneralTypeIssues] + check(assert_type(s.add_suffix("_item", axis="columns"), pd.Series), pd.Series) # type: ignore[arg-type] # pyright: ignore[reportGeneralTypeIssues] From c6f9ba076c2411dc386547f9b10e271ec27daf58 Mon Sep 17 00:00:00 2001 From: ramvikrams Date: Wed, 12 Apr 2023 21:52:46 +0530 Subject: [PATCH 9/9] Update test_series.py --- tests/test_series.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/test_series.py b/tests/test_series.py index 3a567cd3c..8435c134b 100644 --- a/tests/test_series.py +++ b/tests/test_series.py @@ -1824,6 +1824,4 @@ def test_prefix_summix_axis() -> None: if TYPE_CHECKING_INVALID_USAGE: check(assert_type(s.add_prefix("_item", axis=1), pd.Series), pd.Series) # type: ignore[arg-type] # pyright: ignore[reportGeneralTypeIssues] - check(assert_type(s.add_suffix("_item", axis=1), pd.Series), pd.Series) # type: ignore[arg-type] # pyright: ignore[reportGeneralTypeIssues] - check(assert_type(s.add_prefix("_item", axis="columns"), pd.Series), pd.Series) # type: ignore[arg-type] # pyright: ignore[reportGeneralTypeIssues] check(assert_type(s.add_suffix("_item", axis="columns"), pd.Series), pd.Series) # type: ignore[arg-type] # pyright: ignore[reportGeneralTypeIssues]