Skip to content

Commit 7acec4f

Browse files
authored
TST: Add test for numpy.maximum with Timestamp and Series of datetime64 (#59338)
Add test for `numpy.maximum` with `Timestamp` and `datetime64` `Series`
1 parent 9b375be commit 7acec4f

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pandas/tests/arithmetic/test_datetime64.py

+16
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,22 @@ def test_dt64_compare_datetime_scalar(self, datetimelike, op, expected):
389389
expected = Series(expected, name="A")
390390
tm.assert_series_equal(result, expected)
391391

392+
def test_ts_series_numpy_maximum(self):
393+
# GH#50864, test numpy.maximum does not fail
394+
# given a TimeStamp and Series(with dtype datetime64) comparison
395+
ts = Timestamp("2024-07-01")
396+
ts_series = Series(
397+
["2024-06-01", "2024-07-01", "2024-08-01"],
398+
dtype="datetime64[us]",
399+
)
400+
401+
expected = Series(
402+
["2024-07-01", "2024-07-01", "2024-08-01"],
403+
dtype="datetime64[us]",
404+
)
405+
406+
tm.assert_series_equal(expected, np.maximum(ts, ts_series))
407+
392408

393409
class TestDatetimeIndexComparisons:
394410
# TODO: moved from tests.indexes.test_base; parametrize and de-duplicate

0 commit comments

Comments
 (0)