From 7a97fb75e5f40863fbf4898dfcae65dbde812222 Mon Sep 17 00:00:00 2001 From: Michael Tiemann <72577720+MichaelTiemannOSC@users.noreply.github.com> Date: Sat, 12 Aug 2023 22:52:54 -0400 Subject: [PATCH] Update pint_array.py Delete the last vestiges of some old code from a different PR. Also use Pandas public APIs for `infer_dtype` (used in `_from_factorized`). Signed-off-by: Michael Tiemann <72577720+MichaelTiemannOSC@users.noreply.github.com> --- pint_pandas/pint_array.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/pint_pandas/pint_array.py b/pint_pandas/pint_array.py index 566caad..d071bd2 100644 --- a/pint_pandas/pint_array.py +++ b/pint_pandas/pint_array.py @@ -320,11 +320,6 @@ def __setitem__(self, key, value): # doing nothing here seems to be ok return - try: - next(i for i in self._data if pd.notna(i)) - except StopIteration: - pass - if isinstance(value, _Quantity): value = value.to(self.units).magnitude elif is_list_like(value) and len(value) > 0: @@ -557,7 +552,7 @@ def _from_sequence_of_strings(cls, scalars, dtype=None, copy=False): @classmethod def _from_factorized(cls, values, original): - from pandas._libs.lib import infer_dtype + from pandas.api.types import infer_dtype if infer_dtype(values) != "object": values = pd.array(values, copy=False)