From 3cec545408ce9e66e3b6b240aa3eaf73a350f40c Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Sat, 25 Jun 2022 15:52:54 +0200 Subject: [PATCH 1/3] typ: _item_cache and _ixs --- pandas/core/frame.py | 2 +- pandas/core/generic.py | 4 ++-- pandas/core/series.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index b4a278185b01b..83b3bdc36d2dc 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -3558,7 +3558,7 @@ def T(self) -> DataFrame: # ---------------------------------------------------------------------- # Indexing Methods - def _ixs(self, i: int, axis: int = 0): + def _ixs(self, i: int, axis: int = 0) -> Series: """ Parameters ---------- diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 589ea6e67d926..b5d72bbf13d0b 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -2014,7 +2014,7 @@ def __getstate__(self) -> dict[str, Any]: } @final - def __setstate__(self, state): + def __setstate__(self, state) -> None: if isinstance(state, BlockManager): self._mgr = state elif isinstance(state, dict): @@ -2047,7 +2047,7 @@ def __setstate__(self, state): elif len(state) == 2: raise NotImplementedError("Pre-0.12 pickles are no longer supported") - self._item_cache = {} + self._item_cache: Dict[Hashable, Series] = {} # ---------------------------------------------------------------------- # Rendering Methods diff --git a/pandas/core/series.py b/pandas/core/series.py index 6ebee74810305..06815348fe4b9 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -932,7 +932,7 @@ def _take_with_is_copy(self, indices, axis=0) -> Series: """ return self.take(indices=indices, axis=axis) - def _ixs(self, i: int, axis: int = 0): + def _ixs(self, i: int, axis: int = 0) -> Any: """ Return the i-th value or values in the Series by location. From 03fdc972b589bded84d9a4a5d8c8e79aa386d3be Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Sun, 26 Jun 2022 10:11:42 +0200 Subject: [PATCH 2/3] fixup docstring --- pandas/core/frame.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 83b3bdc36d2dc..932805463d1c3 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -3565,9 +3565,9 @@ def _ixs(self, i: int, axis: int = 0) -> Series: i : int axis : int - Notes - ----- - If slice passed, the resulting data will be a view. + Returns + ------- + Series """ # irow if axis == 0: From 94d0ee9bb3377b95ed3daf75e156d5c46066374a Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Sun, 26 Jun 2022 10:19:11 +0200 Subject: [PATCH 3/3] linting --- pandas/core/generic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index b5d72bbf13d0b..a10cfe1c615fa 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -2047,7 +2047,7 @@ def __setstate__(self, state) -> None: elif len(state) == 2: raise NotImplementedError("Pre-0.12 pickles are no longer supported") - self._item_cache: Dict[Hashable, Series] = {} + self._item_cache: dict[Hashable, Series] = {} # ---------------------------------------------------------------------- # Rendering Methods