Skip to content

Commit ccaf040

Browse files
cpcloudjreback
authored andcommitted
Fix Timestamp __ne__ comparison issue
1 parent 278b06c commit ccaf040

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

doc/source/whatsnew/v0.17.0.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ See the :ref:`documentation <io.excel>` for more details.
227227

228228
df = pd.read_excel('test.xlsx', header=[0,1], index_col=[0,1])
229229
df
230-
230+
231231
.. ipython:: python
232232
:suppress:
233233

@@ -494,7 +494,7 @@ Datetime with TZ
494494

495495
We are adding an implementation that natively supports datetime with timezones. A ``Series`` or a ``DataFrame`` column previously
496496
*could* be assigned a datetime with timezones, and would work as an ``object`` dtype. This had performance issues with a large
497-
number rows. See the :ref:`docs <timeseries.timezone_series>` for more details. (:issue:`8260`, :issue:`10763`).
497+
number rows. See the :ref:`docs <timeseries.timezone_series>` for more details. (:issue:`8260`, :issue:`10763`, :issue:`11034`).
498498

499499
The new implementation allows for having a single-timezone across all rows, with operations in a performant manner.
500500

@@ -966,7 +966,6 @@ Bug Fixes
966966
- Bug in ``Series.count`` when index has nulls (:issue:`10946`)
967967
- Bug in pickling of a non-regular freq ``DatetimeIndex`` (:issue:`11002`)
968968
- Bug causing ``DataFrame.where`` to not respect the ``axis`` parameter when the frame has a symmetric shape. (:issue:`9736`)
969-
970969
- Bug in ``Table.select_column`` where name is not preserved (:issue:`10392`)
971970
- Bug in ``offsets.generate_range`` where ``start`` and ``end`` have finer precision than ``offset`` (:issue:`9907`)
972971
- Bug in ``pd.rolling_*`` where ``Series.name`` would be lost in the output (:issue:`10565`)

pandas/core/ops.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -672,10 +672,7 @@ def na_op(x, y):
672672
else:
673673
y = y.view('i8')
674674

675-
if name == '__ne__':
676-
mask = notnull(x)
677-
else:
678-
mask = isnull(x)
675+
mask = isnull(x)
679676

680677
x = x.view('i8')
681678

pandas/tseries/tests/test_timeseries.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2152,7 +2152,6 @@ def test_period_resample_with_local_timezone_dateutil(self):
21522152
expected = pd.Series(1, index=expected_index)
21532153
assert_series_equal(result, expected)
21542154

2155-
21562155
def test_pickle(self):
21572156

21582157
# GH4606
@@ -2171,6 +2170,26 @@ def test_pickle(self):
21712170
idx_p = self.round_trip_pickle(idx)
21722171
tm.assert_index_equal(idx, idx_p)
21732172

2173+
def test_timestamp_equality(self):
2174+
2175+
# GH 11034
2176+
s = Series([Timestamp('2000-01-29 01:59:00'),'NaT'])
2177+
result = s != s
2178+
assert_series_equal(result, Series([False,True]))
2179+
result = s != s[0]
2180+
assert_series_equal(result, Series([False,True]))
2181+
result = s != s[1]
2182+
assert_series_equal(result, Series([True,True]))
2183+
2184+
result = s == s
2185+
assert_series_equal(result, Series([True,False]))
2186+
result = s == s[0]
2187+
assert_series_equal(result, Series([True,False]))
2188+
result = s == s[1]
2189+
assert_series_equal(result, Series([False,False]))
2190+
2191+
2192+
21742193
def _simple_ts(start, end, freq='D'):
21752194
rng = date_range(start, end, freq=freq)
21762195
return Series(np.random.randn(len(rng)), index=rng)

0 commit comments

Comments
 (0)