def test_tdi_mul_int_series(self, names): # GH#19042 tdi = pd.TimedeltaIndex(['0days', '1day', '2days', '3days', '4days'], name=names[0]) ser = Series([0, 1, 2, 3, 4], dtype=np.int64, name=names[1]) expected = Series(['0days', '1day', '4days', '9days', '16days'], dtype='timedelta64[ns]', name=names[2]) result = ser * tdi tm.assert_series_equal(result, expected) # The direct operation tdi * ser still needs to be fixed. result = ser.__rmul__(tdi) tm.assert_series_equal(result, expected)
def test_tdi_mul_int_series(self, names): # GH#19042 tdi = pd.TimedeltaIndex(['0days', '1day', '2days', '3days', '4days'], name=names[0]) ser = Series([0, 1, 2, 3, 4], dtype=np.int64, name=names[1]) expected = Series(['0days', '1day', '4days', '9days', '16days'], dtype='timedelta64[ns]', name=names[2]) result = ser * tdi tm.assert_series_equal(result, expected) # The direct operation tdi * ser still needs to be fixed. result = ser.__rmul__(tdi) tm.assert_series_equal(result, expected)
def test_td64arr_mul_int_series(self, box, names): # GH#19042 test for correct name attachment tdi = TimedeltaIndex(['0days', '1day', '2days', '3days', '4days'], name=names[0]) ser = Series([0, 1, 2, 3, 4], dtype=np.int64, name=names[1]) expected = Series(['0days', '1day', '4days', '9days', '16days'], dtype='timedelta64[ns]', name=names[2]) tdi = tm.box_expected(tdi, box) box = Series if (box is pd.Index and type(ser) is Series) else box expected = tm.box_expected(expected, box) result = ser * tdi tm.assert_equal(result, expected) # The direct operation tdi * ser still needs to be fixed. result = ser.__rmul__(tdi) tm.assert_equal(result, expected)