Skip to content

Commit

Permalink
Update pint_array.py
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
MichaelTiemannOSC committed Aug 13, 2023
1 parent 053f903 commit 7a97fb7
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions pint_pandas/pint_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7a97fb7

Please sign in to comment.