-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
CLN: remove block._coerce_values #27567
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
Conversation
|
#27445 is a subset of this |
| # indexing | ||
| result = df.iloc[1] | ||
| expected = Series( | ||
| [Timestamp("2013-01-02 00:00:00-0500", tz="US/Eastern"), np.nan, np.nan], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does this not work now (the existing code)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the test is incorrect, and tm.assert_series_equal is getting it wrong.
now = pd.Timestamp.now("US/Eastern")
left = pd.Series([now, pd.NaT, pd.NaT], dtype=object)
right = pd.Series([now, np.nan, np.nan], dtype=object)
tm.assert_series_equal(left, right)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will open an issue for assert_series_equal
| if isinstance(result, np.ndarray): | ||
| if result.dtype.kind in ["i", "f"]: | ||
| result = result.astype("M8[ns]") | ||
| if result.ndim == 2: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a comment or 2 here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| # but `Block.get_values()` returns an ndarray of objects | ||
| # right now. We need an API for "values to do numeric-like ops on" | ||
| values = self.values.asi8 | ||
| values = self.values.view("M8[ns]") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should probably remove .asi8 on Index as I agree its sligthly confusing (I don't think we need deprecation)
|
thanks |
viable now that we stopped coercing timedelta and datetime to i8
I'd like to clean up DatetimeTZBlock._try_coerce_result before getting this in. Part of that means pushing the handling down to the function being wrapped