We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3217b43 commit 179fe3aCopy full SHA for 179fe3a
pandas/tests/series/indexing/test_setitem.py
@@ -405,6 +405,18 @@ def test_setitem_empty_series_datetimeindex_preserves_freq(self):
405
tm.assert_series_equal(series, expected)
406
assert series.index.freq == expected.index.freq
407
408
+ def test_setitem_empty_series_timestamp_preserves_dtype(self):
409
+ # GH 21881
410
+ timestamp = Timestamp(1412526600000000000)
411
+ series = Series([timestamp], index=["timestamp"], dtype=object)
412
+ expected = series["timestamp"]
413
+
414
+ series = Series([], dtype=object)
415
+ series["anything"] = 300.0
416
+ series["timestamp"] = timestamp
417
+ result = series["timestamp"]
418
+ assert result == expected
419
420
421
def test_setitem_scalar_into_readonly_backing_data():
422
# GH#14359: test that you cannot mutate a read only buffer
0 commit comments