Skip to content
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pandas/_libs/tslibs/timedeltas.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ from pandas._libs.tslibs.offsets import Day

from pandas._libs.tslibs.util cimport (
is_array,
is_bool_object,
is_float_object,
is_integer_object,
)
Expand Down Expand Up @@ -2311,6 +2312,13 @@ class Timedelta(_Timedelta):
return self.__mul__(item)
return other * self.to_timedelta64()

elif is_bool_object(other):
# GH#62316
raise TypeError(
"Cannot multiply Timedelta by bools. "
"Explicitly cast to integers instead."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bool and integer singular

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, I've changed it to singular

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bool and integer singular look better to me too, but I found that in pandas we use both the singular and the plural and sometimes we mix them:

f"Cannot multiply '{self.dtype}' by bool, explicitly cast to "
"integers instead"

)

return NotImplemented

__rmul__ = __mul__
Expand Down
Loading