Skip to content
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

BUG: Series([ints], dtype=td[non-nano]) not respecting unit #52463

Closed

Conversation

mroeschke
Copy link
Member

I think this should be backported since non-nano support is a new feature in 2.0

@mroeschke mroeschke added Timedelta Timedelta data type Non-Nano datetime64/timedelta64 with non-nanosecond resolution labels Apr 5, 2023
@mroeschke mroeschke added this to the 2.0.1 milestone Apr 5, 2023
@@ -2096,15 +2077,15 @@ def test_constructor_no_pandas_array(self, using_array_manager):

@td.skip_array_manager_invalid_test
def test_from_array(self):
result = Series(pd.array(["1H", "2H"], dtype="timedelta64[ns]"))
result = Series(pd.array([1, 2], dtype="timedelta64[ns]"))
Copy link
Member

Choose a reason for hiding this comment

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

why do these need to change?

Copy link
Member Author

Choose a reason for hiding this comment

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

This goes through array_to_timedelta64 seems not to handle string arguments if unit is specified. I suppose this makes sense since "1H" conflicts in unit with ns in the dtype

@jbrockmendel
Copy link
Member

So I've had a branch aimed at this issue sitting on the backburner for a while now and been indecisive about how to handle this. In particular this makes Series(values, dtype=dtype) inconsistent with Series(values.astype(object), dtype=dtype) i think

@mroeschke
Copy link
Member Author

I was thinking this qualified as a "bug fix" since we officially support non-nano units.

@jbrockmendel
Copy link
Member

would it be helpful if i pushed the WIP branch i mentioned to see if there is anything there worth cannibalizing?

@mroeschke
Copy link
Member Author

would it be helpful if i pushed the WIP branch i mentioned to see if there is anything there worth cannibalizing?

Definitely! With the test failures maybe the scope of this change is larger than I expected

@mroeschke
Copy link
Member Author

Not making much progress with this so closing for now

@mroeschke mroeschke closed this Apr 24, 2023
@mroeschke mroeschke deleted the bug/constr/sers_td_nonnano branch April 24, 2023 20:47
@jbrockmendel jbrockmendel added the Mothballed Temporarily-closed PR the author plans to return to label Jul 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Mothballed Temporarily-closed PR the author plans to return to Non-Nano datetime64/timedelta64 with non-nanosecond resolution Timedelta Timedelta data type
Projects
None yet
3 participants