Skip to content

Commit 9cfee9e

Browse files
committed
reflect review
1 parent f680ca6 commit 9cfee9e

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

doc/source/whatsnew/v0.24.0.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,7 @@ Interval
646646
Indexing
647647
^^^^^^^^
648648

649+
- Bug in :meth:`DataFrame.ne` fails if columns contain column name "dtype" (:issue:`22383`)
649650
- The traceback from a ``KeyError`` when asking ``.loc`` for a single missing label is now shorter and more clear (:issue:`21557`)
650651
- When ``.ix`` is asked for a missing integer label in a :class:`MultiIndex` with a first level of integer type, it now raises a ``KeyError``, consistently with the case of a flat :class:`Int64Index, rather than falling back to positional indexing (:issue:`21593`)
651652
- Bug in :meth:`DatetimeIndex.reindex` when reindexing a tz-naive and tz-aware :class:`DatetimeIndex` (:issue:`8306`)
@@ -654,8 +655,7 @@ Indexing
654655
- Fixed ``DataFrame[np.nan]`` when columns are non-unique (:issue:`21428`)
655656
- Bug when indexing :class:`DatetimeIndex` with nanosecond resolution dates and timezones (:issue:`11679`)
656657
- Bug where indexing with a Numpy array containing negative values would mutate the indexer (:issue:`21867`)
657-
- Bug Dataframe.ne fails if columns containing column name 'dtype'
658-
658+
-
659659

660660
Missing
661661
^^^^^^^

pandas/core/computation/expressions.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,7 @@ def _has_bool_dtype(x):
161161
try:
162162
if not isinstance(x.dtype, np.dtype):
163163
x = x.rename({'dtype': 'temporary_dtype'}, axis=1)
164-
return x.dtype == bool
165-
else:
166-
return x.dtype == bool
164+
return x.dtype == bool
167165
except AttributeError:
168166
try:
169167
return 'bool' in x.dtypes

pandas/tests/test_expressions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ def test_bool_ops_warn_on_arithmetic(self):
444444
tm.assert_frame_equal(r, e)
445445

446446
def test_bool_ops_column_name_dtype(self):
447-
# GH 22383 - .ne fails if columns containing column name 'dtype'
447+
# GH 22383 - .ne fails if columns containing column name 'dtype'
448448
df_has_error = DataFrame([[0, 1, 2, 'aa'], [0, 1, 2, 'aa'],
449449
[0, 1, 5, 'bb'], [0, 1, 5, 'bb'],
450450
[0, 1, 5, 'bb'], ['cc', 4, 4, 4]],

0 commit comments

Comments
 (0)