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

feat: Add support for series[other_series] #2013

Merged
merged 9 commits into from
Feb 15, 2025

Conversation

FBruzzesi
Copy link
Member

What type of PR is this? (check all applicable)

  • πŸ’Ύ Refactor
  • ✨ Feature
  • πŸ› Bug Fix
  • πŸ”§ Optimization
  • πŸ“ Documentation
  • βœ… Test
  • 🐳 Other

Related issues

Checklist

  • Code follows style guide (ruff)
  • Tests added
  • Documented the changes

If you have comments or can explain your changes, please do so below

Copy link
Member Author

Choose a reason for hiding this comment

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

Moved all the __getitem__ tests previously in slice_test.py

@@ -156,7 +159,9 @@ def __getitem__(self: Self, idx: int | slice | Sequence[int]) -> Any | Self:
is_numpy_scalar(idx) and idx.dtype.kind in ("i", "u")
):
return self._compliant_series[idx]
return self._from_compliant_series(self._compliant_series[idx])
return self._from_compliant_series(
self._compliant_series[to_native(idx, pass_through=True)]
Copy link
Member Author

@FBruzzesi FBruzzesi Feb 14, 2025

Choose a reason for hiding this comment

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

Kind of unrelated, but we have a method called _extract_native which actually (maybe) extracts compliant πŸ™ˆ

Copy link
Member

Choose a reason for hiding this comment

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

that's an awfully good point

@dangotbanned dangotbanned changed the title fear: Add support for series[other_series] feat: Add support for series[other_series] Feb 14, 2025
@dangotbanned
Copy link
Member

😨 #2013 (comment)

@FBruzzesi FBruzzesi added the enhancement New feature or request label Feb 14, 2025
@FBruzzesi
Copy link
Member Author

😨 #2013 (comment)

Took me 10 seconds to figure out what changed 😁 thanks a ton 🀩

@FBruzzesi FBruzzesi added the high priority Your PR will be reviewed very quickly if you address this label Feb 14, 2025
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

thanks for doing this! just got a question

@@ -156,7 +159,9 @@ def __getitem__(self: Self, idx: int | slice | Sequence[int]) -> Any | Self:
is_numpy_scalar(idx) and idx.dtype.kind in ("i", "u")
):
return self._compliant_series[idx]
return self._from_compliant_series(self._compliant_series[idx])
return self._from_compliant_series(
self._compliant_series[to_native(idx, pass_through=True)]
Copy link
Member

Choose a reason for hiding this comment

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

that's an awfully good point

Comment on lines +55 to +57
@pytest.mark.filterwarnings(
"ignore:.*_array__ implementation doesn't accept a copy keyword.*:DeprecationWarning:modin"
)
Copy link
Member

Choose a reason for hiding this comment

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

is this just something that Modin calls (on itself?) internally? not anything we need to concern ourselves with?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it traces back to modin/pandas/indexing.py

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

Reviewing from my phone but should be good thanks @FBruzzesi !

@MarcoGorelli MarcoGorelli merged commit 994bce4 into main Feb 15, 2025
27 of 28 checks passed
@MarcoGorelli MarcoGorelli deleted the feat/series-getitem-by-other-series branch February 15, 2025 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request high priority Your PR will be reviewed very quickly if you address this
Projects
None yet
Development

Successfully merging this pull request may close these issues.

enh: allow passing Series to Series.__getitem__
4 participants