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: add conversion from slice to array for selecting rows in pyarrow __getitem__ #978

Merged
merged 2 commits into from
Sep 15, 2024

Conversation

raisadz
Copy link
Contributor

@raisadz raisadz commented Sep 15, 2024

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

@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.

awesome! thanks @raisadz !

@MarcoGorelli MarcoGorelli merged commit 60ed72e into narwhals-dev:main Sep 15, 2024
22 checks passed
from narwhals._arrow.series import ArrowSeries

# PyArrow columns are always strings
col_name = item[1] if isinstance(item[1], str) else self.columns[item[1]]
assert not isinstance(item[0], str) # help mypy # noqa: S101
Copy link
Member

Choose a reason for hiding this comment

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

Fancy changing this from assert to a raise statement as a follow up?

the dangers of assert in python

TL;DR: assert is only run in debug mode, if you run python with the optimized flag, that will be skipped.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your comment @FBruzzesi , I replaced assert with raise in this PR #980

Please, note that the line never gets hit so # pragma: no cover is added

Copy link
Member

Choose a reason for hiding this comment

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

Oh I see, thanks for pointing that out πŸ‘Œ! Let's move the conversation there anyway

@raisadz raisadz deleted the pyarrow-getitem branch November 7, 2024 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Pyarrow __getitem__ fails with integer for column position
3 participants