Skip to content

Commit 20b4c29

Browse files
authored
CLN: NDFrame._where, comment typos (#37922)
1 parent 79a184a commit 20b4c29

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

pandas/core/generic.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -9020,7 +9020,6 @@ def _where(
90209020
cond = -cond if inplace else cond
90219021

90229022
# try to align with other
9023-
try_quick = True
90249023
if isinstance(other, NDFrame):
90259024

90269025
# align with me
@@ -9059,12 +9058,11 @@ def _where(
90599058
# match True cond to other
90609059
elif len(cond[icond]) == len(other):
90619060

9062-
# try to not change dtype at first (if try_quick)
9063-
if try_quick:
9064-
new_other = np.asarray(self)
9065-
new_other = new_other.copy()
9066-
new_other[icond] = other
9067-
other = new_other
9061+
# try to not change dtype at first
9062+
new_other = np.asarray(self)
9063+
new_other = new_other.copy()
9064+
new_other[icond] = other
9065+
other = new_other
90689066

90699067
else:
90709068
raise ValueError(

pandas/core/internals/blocks.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1423,6 +1423,7 @@ def where(
14231423
if values.ndim - 1 == other.ndim and axis == 1:
14241424
other = other.reshape(tuple(other.shape + (1,)))
14251425
elif transpose and values.ndim == self.ndim - 1:
1426+
# TODO(EA2D): not neceesssary with 2D EAs
14261427
cond = cond.T
14271428

14281429
if not hasattr(cond, "shape"):
@@ -2399,9 +2400,8 @@ def _can_hold_element(self, element: Any) -> bool:
23992400
return is_valid_nat_for_dtype(element, self.dtype)
24002401

24012402
def fillna(self, value, **kwargs):
2402-
2403-
# allow filling with integers to be
2404-
# interpreted as nanoseconds
2403+
# TODO(EA2D): if we operated on array_values, TDA.fillna would handle
2404+
# raising here.
24052405
if is_integer(value):
24062406
# Deprecation GH#24694, GH#19233
24072407
raise TypeError(

pandas/core/series.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ def __setitem__(self, key, value):
10151015
# positional setter
10161016
values[key] = value
10171017
else:
1018-
# GH#12862 adding an new key to the Series
1018+
# GH#12862 adding a new key to the Series
10191019
self.loc[key] = value
10201020

10211021
except TypeError as err:

pandas/tests/series/test_arithmetic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ def test_align_date_objects_with_datetimeindex(self):
757757
@pytest.mark.parametrize("box", [list, tuple, np.array, pd.Index, pd.Series, pd.array])
758758
@pytest.mark.parametrize("flex", [True, False])
759759
def test_series_ops_name_retention(flex, box, names, all_binary_operators):
760-
# GH#33930 consistent name renteiton
760+
# GH#33930 consistent name retention
761761
op = all_binary_operators
762762

763763
if op is ops.rfloordiv and box in [list, tuple]:

0 commit comments

Comments
 (0)