Example: pandas has a Timedelta subclass. I want to get the number of hours from a given Timedelta. I have two options:
For instance, we may do the following: (a - b) / pd.Timedelta(hours=12) But not (a - b) * pd.Timedelta(hours=1/12)
-
-
sure. the former results in a unitless quantity; the latter results in time squared, which timedelta cannot represent
-
Right, which is not the definition of a scalar.
-
Actually I know of no algebra upon which addition and subtraction and *division* is defined but multiplication is not...

-
Python doesn't have a timesquared type so it omits that operator. perhaps this is an argument for actual units but those are complicated
-
Indeed they are. Which is why it would be a lot more semantically rich to provide methods to support the conversions.
-
Eh, I'd still want the division. Dividing periods by each other is useful.
-
Sure sure -- I'm not saying *remove* that capability. But .to_hours() should be supported.
-
I disagree - then you end up with to_years, to_months, to_weeks, to_days, to_hours, to_minutes, to_seconds, to_miliseconds...
- 3 more replies
New conversation -
-
-
I guess I could expect multiplication to return an int or something
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.