-
Notifications
You must be signed in to change notification settings - Fork 110
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
SNOW-1707707: Add support for Index.to_numpy #2504
Conversation
@@ -2601,6 +2698,10 @@ def __array__(self, dtype: Any = None) -> np.ndarray: | |||
""" | |||
The array interface, return the values. | |||
""" | |||
# Ensure that the existing index dtype is preserved in the returned array | |||
# if no other dtype is given. | |||
if dtype is None: |
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.
This fixes a pre-existing issue that was causing some test failures with the introduction of Index.to_numpy
.
d8d190c
to
bb04347
Compare
bb04347
to
e60801a
Compare
query_count=3 if isinstance(key, native_pd.Index) else 1, join_count=1 | ||
): | ||
# df[boolean list-like key] is the same as df.loc[:, boolean list-like key] | ||
if isinstance(key, native_pd.Index): |
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.
There was no need to convert the native pandas index into a Snowpark pandas index when the df it's being passed to is actually a native pandas DataFrame. This was also causing test failures on the introduction of Index.to_numpy
.
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.
thanks!
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.
Nice work, LGTM!
Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes SNOW-1707707
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
Add support for Index.to_numpy.