-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
pd.to_timedelta(single_string) returns a Series, which ruins broadcasting. #5410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
this is correct (and on purpose); we don't have a timedelta scalar ATM (like Timestamp), so only option is to return a timedelta64, which works but is not friendly |
Understood. |
this particular usage is easy to fix though (this is a_bug_ I guess in the timedelta subtraction) operation....marking for 0.14 |
So, until Timedelta scalars come along, worth submitting a PR that returns timedelta64 when input is not list-like? |
or...could just have a single element |
Yeah, I think we are saying the same thing. I'll make a PR. |
you can try it and see what breaks...it should work (I think)....and I think that is right actually...(to return a single-element as a timedelta64, bascially just don't box it), |
BUG: to_timedelta of a scalar returns a scalar, closes #5410.
Currently
because
More expected and consistent behavior, in my opinion, would be
If, instead,
pd.to_timedelta('00:03:00')
gavenumpy.timedelta64(180000000000,'ns')
, it would broadcast properly, as demonstrated by this work-aroundI have not regularly used timedeltas until now. Am I misjudging the expected usage?
Update, OK, one can also get the expected result by setting
box=False
. Butbox=False
should be default for a scalar, no?The text was updated successfully, but these errors were encountered: